Newsgroups: news.software.b
Path: utzoo!utgpu!utstat!geoff
From: geoff@utstat.uucp (Geoff Collyer)
Subject: Re: Cnews lets outside control messages create groups
Message-ID: <1989Jul10.045219.3927@utstat.uucp>
Organization: Statistics, U. of Toronto
References: <1989Jul7.174914.22890@ivucsb.sba.ca.us> <1989Jul9.040539.28044@utzoo.uucp> <1989Jul9.185601.28603@ladc.bull.com>
Date: Mon, 10 Jul 89 04:52:19 GMT

> >Edit /usr/lib/newsbin/ctl/newgroup to do whatever you want.  It's a shell
> >file.  See notebook/ctlmsg for some insight into how control messages work,
> >if you haven't looked at it already.
> Yeah, I could do that.  If I had time.  It seems to me, though, that there
> should be a configuration parameter somewhere that would do the job for me,
> a la NORMGROUP/NONEWGROUP in B news.

Henry and I are in the business of providing tools, not solutions to the
wrong problems.  We cannot possibly guess what everyone in the world is
going to want, nor do we want to distribute a gargantuan distribution
consisting of the union of all possible wish lists.  We are interested
in genuine bug reports, but failing to behave like B news (as opposed to
failing to meet RFC 1036) is not a bug.  I'm afraid we don't have a lot
of sympathy for people who can't be bothered to make one-line changes to
shell scripts.  If the distribution merely doesn't do what you want, you
have the source and an editor.

> I've noticed this too.  And, Geoff, I think what Todd means is that C news
> should notify the news admin, _without_ performing the newgroup/rmgroup.
> Then the news admin (me) could manually create or remove the group.

Again, read the source; newgroup and rmgroup do nothing destructive.
newgroup creates the group and both newgroup and rmgroup send mail to
$NEWSMASTER (usenet by default).  If you don't want the new group, you
probably want to change its active flag to x rather than deleting its
active file entry, but even deleting the active entry is trivial.

In an attempt to bring some DATA (tm John Mashey) to this discussion,
here are newgroup and rmgroup:

---
#! /bin/sh
# newgroup group flag - create group (4-field version: B-2.10.3+ compatible)
#	subject to our sys file group pattern

# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
. ${NEWSCONFIG-/usr/lib/news/bin/config}
export NEWSCTL NEWSBIN NEWSARTS
PATH=$NEWSCTL/bin:$NEWSBIN/relay:$NEWSBIN:$NEWSPATH ; export PATH # include mkpdir
umask $NEWSUMASK

F=/tmp/nc$$

trap "rm -f $F; exit 0" 0
cat >$F

# unapproved ctl msg? then quit
grep -s '^Approved:' $F >/dev/null || { rm -f $F; exit 0; }

SENDER="`grep '^Sender:' $F | sed 's/^[^:]*: *//'`"
case "$SENDER" in
"")	SENDER="`grep '^From:' $F | sed 's/^[^:]*: *//' `" ;;
esac

greppat="^`echo $1 | sed 's/\./\\\\./g' ` "
if grep -s "$greppat" $NEWSCTL/active >/dev/null; then	# group exists?
	export SENDER
	chamod "$1" "$2" 		# change moderated flag if needed
	exit
fi

me="`newshostname`"
gngppat=`awk -f $NEWSBIN/relay/canonsys.awk $NEWSCTL/sys |
	egrep "^($me|ME):" |
	awk -F: '
{
	fields = split($2, field2, "/")	# split ngs/dists
	print field2[1]			# print only ngs
	exit
}' `

if gngp -a "$gngppat" >/dev/null <<!
$1
!
then			# no group in active, but sys file likes it: make it
	case "$2" in
	moderated)	flag=m ;;
	*)		flag=y ;;
	esac
	echo "$1 0000000000 00000 $flag" >>$NEWSCTL/active
	(echo "$1 `getdate now` $SENDER" >>$NEWSCTL/active.times)  # rn hook
	# make the directory since rn will bitch if it's missing
	mkpdir $NEWSARTS/`echo $1 | tr . / `
	echo "newsgroup $1 was created by $SENDER." | mail $NEWSMASTER
fi
---
#! /bin/sh
# rmgroup group - snuff group

# =()<. ${NEWSCONFIG-@<NEWSCONFIG>@}>()=
. ${NEWSCONFIG-/usr/lib/news/bin/config}
export NEWSCTL NEWSBIN NEWSARTS
PATH=$NEWSCTL/bin:$NEWSBIN:$NEWSPATH ; export PATH
umask $NEWSUMASK

F=/tmp/nc$$

cat >$F

# unapproved ctl msg? then quit
egrep '^Approved:' $F >/dev/null || { rm -f $F; exit 0; }

# quit if no active entry
egrep "^`echo $1 | sed 's/\./\\\\./g'` " $NEWSCTL/active >/dev/null ||
	{ rm -f $F; exit 0; }

SENDER="`grep '^Sender:' $F | sed 's/^[^:]*: *//'`"
case "$SENDER" in
"")
	SENDER="`grep '^From:' $F | sed 's/^[^:]*: *//'`"
	;;
esac

# tell the local usenet administrator to do it by hand
echo "rmgroup $1 says $SENDER" | mail $NEWSMASTER

rm -f $F*
---
-- 
Geoff Collyer		utzoo!utstat!geoff, geoff@utstat.toronto.edu
``... skill such as yours is evidence of a misspent youth.'' - Herbert Spencer
