[news.software.b] Cnews lets outside control messages create groups

todd@ivucsb.sba.ca.us (Todd Day) (07/08/89)

I noticed today that Cnews lets incoming control messages have
their way (at least in creating groups).  How can I make it so
that the news administrator is notified every time a control
request comes in (like Bnews) so that the news admin can create
or destroy groups or change moderation as he sees fit?

-- 

Todd Day | todd@ivucsb.sba.ca.us | ivucsb!todd@anise.acc.com
"Santa Barbara - so many babes... so few who will talk to me."

geoff@utstat.uucp (Geoff Collyer) (07/09/89)

In several recent messages, people have speculated without cause about
alleged misfeatures in C news (aside: why do people insist on spelling
"C news" as "Cnews"? if someone said "Cnews" to me, I'd say
"Gesundheit!").  Todd Day's most spectacular groundless speculation is:

> I noticed today that Cnews lets incoming control messages have
> their way (at least in creating groups).  How can I make it so
> that the news administrator is notified every time a control
> request comes in (like Bnews) so that the news admin can create
> or destroy groups or change moderation as he sees fit?

: stat; cd /usr/lib/newsbin/ctl; grep mail newgroup rmgroup
newgroup:       echo "newsgroup $1 was created by $SENDER." | mail $NEWSMASTER
rmgroup:echo "rmgroup $1 says $SENDER" | mail $NEWSMASTER

In future, would people posting reports of alleged bugs in C news please
first check that they are running C news and try to verify the alleged
bugs by examining the code (which often turns out to be shell scripts)
to confirm that there is a non-zero probability that the alleged bug
actually exists?
-- 
Geoff Collyer		utzoo!utstat!geoff, geoff@utstat.toronto.edu
``... skill such as yours is evidence of a misspent youth.'' - Herbert Spencer

henry@utzoo.uucp (Henry Spencer) (07/09/89)

In article <1989Jul7.174914.22890@ivucsb.sba.ca.us> todd@ivucsb.sba.ca.us (Todd Day) writes:
>I noticed today that Cnews lets incoming control messages have
>their way (at least in creating groups).  How can I make it so
>that the news administrator is notified every time a control
>request comes in (like Bnews) so that the news admin can create
>or destroy groups or change moderation as he sees fit?

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.
-- 
$10 million equals 18 PM       |     Henry Spencer at U of Toronto Zoology
(Pentagon-Minutes). -Tom Neff  | uunet!attcan!utzoo!henry henry@zoo.toronto.edu

frank@ladc.bull.com (Frank Mayhar) (07/10/89)

In article <1989Jul9.040539.28044@utzoo.uucp> henry@utzoo.uucp (Henry Spencer) writes:
>In article <1989Jul7.174914.22890@ivucsb.sba.ca.us> todd@ivucsb.sba.ca.us (Todd Day) writes:
>>I noticed today that Cnews lets incoming control messages have
>>their way (at least in creating groups).  [...]

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.

>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.

Otherwise, I'm quite happy with C news.  Sure as h*ll beats B news, speed-wise.
-- 
Frank Mayhar  frank@ladc.bull.com (..!{uunet,hacgate,rdahp}!ladcgw!frank)
              Bull HN Information Systems Inc.  Los Angeles Development Center
              5250 W. Century Blvd., LA, CA  90045    Phone:  (213) 216-6241

geoff@utstat.uucp (Geoff Collyer) (07/10/89)

> >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

todd@ivucsb.sba.ca.us (Todd Day) (07/10/89)

~> I noticed today that Cnews lets incoming control messages have
~> their way (at least in creating groups).

This much IS TRUE!

~> How can I make it so
~> that the news administrator is notified every time a control
~> request comes in (like Bnews) so that the news admin can create
~> or destroy groups or change moderation as he sees fit?

OK, I put it kinda cryptically... Rephrasing...

"How can I make it so that the news administrator is notified every time
a control request comes in (like Bnews) WITHOUT THE NEW GROUP BEING
CREATED, so that the news admin can create groups or change
moderation as he sees fit?"

I did get notified.  What I meant, is, "Are there any flags in the config
files that I should be setting so that groups are not created by the whims
of a new administrator, but so that I am notified so *I* can
go ahead and create these groups myself?"

[I call it Cnews 'cause I keep the source in /usr/local/src/Cnews]

After looking at the shell scripts (which I don't want to change myself
for fear of being incompatible with future versions of Cnews), I see
it's indeed impossible via any flag setting to accomplish what I want
to above.  What the C news gurus seem to be saying, is, we put all
that stuff into shell scripts so *you* can change them easily.  If you
don't agree with our philosophy, fine, change those shell scripts.
Is this indeed what you are saying?  If so, and if you don't intend
on updating the shells, I'll go ahead and do it.  But as it is now,
anybody new admin can make those dumb mistakes and moderate and
create groups.  Not destructive, but can be a pain.  At least they
can't remove groups.

I don't mean to carp too much, 'cause I really do like most parts
of C news...  It's always the little things...

-- 

Todd Day | todd@ivucsb.sba.ca.us | ivucsb!todd@anise.acc.com
"Santa Barbara - so many babes... so few who will talk to me."

henry@utzoo.uucp (Henry Spencer) (07/10/89)

In article <1989Jul9.185601.28603@ladc.bull.com> frank@ladcgw.ladc.bull.com (Frank Mayhar) writes:
>... 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.

There is room for an almost unlimited number of configuration parameters to
tweak various details of the software.  There came a time when we had a
choice of adding still more, or shipping the software.  We shipped.

C News as it stands does not provide every possible customization option.
What it does provide, though, is a system that's easier for you to customize.
We may eventually add the most popular customizations as configuration options,
but we expect that there will always be people who want something unusual
enough that they have to do it themselves.
-- 
$10 million equals 18 PM       |     Henry Spencer at U of Toronto Zoology
(Pentagon-Minutes). -Tom Neff  | uunet!attcan!utzoo!henry henry@zoo.toronto.edu

rick@pcrat.uucp (Rick Richardson) (07/11/89)

In article <1989Jul10.065222.29333@ivucsb.sba.ca.us> todd@ivucsb.sba.ca.us (Todd Day) writes:
>
>After looking at the shell scripts (which I don't want to change myself
>for fear of being incompatible with future versions of Cnews), I see
>it's indeed impossible via any flag setting to accomplish what I want
>to above.

This is a valid argument, IMHO.  I hacked the scripts a little bit
to get C news to run, and now I'm afraid to apply the latest patch
for fear of breaking whatever it was that I had to change.  I don't
know if there is an (easy) general solution to this problem of local
customizations and patches conflicting, but it seems to me that
the most obvious ones ought to be taken care of at configuration
time.

The two important options (to me, at least) not handled at configuration
time are auto/manual create/remove groups, and immediate/deferred
input processing.  The use of DBZ was another, but that's supposed
to be standard next time around.

BTW, C news wasn't any panacea here, even with DBZ.  It only forced
me to discover that our bottleneck was uncompress.  It *does* seem
more manageable, though, than B news.

-- 
Rick Richardson | JetRoff "di"-troff to LaserJet Postprocessor|uunet!pcrat!dry2
PC Research,Inc.| Mail: uunet!pcrat!jetroff; For anon uucp do:|for Dhrystone 2
uunet!pcrat!rick| uucp jetroff!~jetuucp/file_list ~nuucp/.    |submission forms.
jetroff Wk2200-0300,Sa,Su ACU {2400,PEP} 12013898963 "" \d\r\d ogin: jetuucp

pell@isy.liu.se (P{r Emanuelsson) (07/11/89)

geoff@utstat.uucp (Geoff Collyer) writes:
>In an attempt to bring some DATA (tm John Mashey) to this discussion,
>here are newgroup and rmgroup:
[...]

>	echo "$1 0000000000 00000 $flag" >>$NEWSCTL/active

But Geoff, this is not the latest version! Bad DATA! :-)

   (Sorry) /Pell
--
"Don't think; let the machine do it for you!"
                                   -- E. C. Berkeley
Dept. of Electrical Engineering	                         pell@isy.liu.se
University of Linkoping, Sweden	                    ...!uunet!isy.liu.se!pell

lmb@vicom.com (Larry Blair) (07/16/89)

In article <1989Jul10.045219.3927@utstat.uucp> geoff@utstat.uucp (Geoff Collyer) writes:
=> >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.

Creating newgroups and, particularly, changing the moderation status of
existing groups automatically is insanity.  The default behavior should
not execute newgroup commands.

=> 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.

Changing the moderation status _is_ destructive.

For anyone who is interested, here is my fixed newgroup.  Note that I used
"mail -s".

#! /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; echo $gngppat; 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
	case "$2" in
	moderated)	flag=m ;;
	*)		flag=y ;;
	esac

	aflag=`awk "/$1/"' { print $4 }' $NEWSCTL/active`
	if test "$aflag" != "$flag" -a \( "$aflag" = m -o "$aflag" = y \); then
	# old & new flags differ & old flag is m or y
	case "$flag" in
	m)	pfx="" ;;
	*)	pfx=un ;;
	esac
	mail -s "Change $1 to ${pfx}moderated" $NEWSMASTER <<!
$SENDER has request that newsgroup $1 be changed to ${pfx}moderated.
!
	fi
	exit
fi

me="`newshostname`"
gngppat=`awk -f $NEWSBIN/relay/canonsys.awk $NEWSCTL/sys |
	egrep "^($me|ME):" |
	awk -F: '
{
	fields = split($2, field2, "/")
	print field2[1]
	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
	# make the directory since rn will bitch if it's missing
	mail -s "Newgroup $1 $2" $NEWSMASTER <<!
$SENDER has requested that you create $1 $2.
!
fi
-- 
Larry Blair   ames!vsi1!lmb   lmb@vicom.com

tale@pawl.rpi.edu (David C Lawrence) (07/17/89)

In <1989Jul16.050248.16940@vicom.com> lmb@vicom.com (Larry Blair) writes:
LB> Creating newgroups and, particularly, changing the moderation status of
LB> existing groups automatically is insanity.  The default behavior should
LB> not execute newgroup commands.

Insanity?  It would make an interesting defence in a trial, that is
for certain.  "You honour, my client clearly can not be held for his
actions.  Why, he even lacks the mental faculties to have defined
NONEWGROUP in his B News configuration!"

Balderdash.  We have NORMGROUP here because of its destructive
behaviour but newgroup messages are honoured.  If the group is really
bogus, like talk.bizarre.nice, I'll rmgroup is soon enough.  In the
meantime, junk gets a whole bunch of articles that my neighbours ship
me because they think the group is valid.  If the status was changed
from unmoderated to moderated, it is mostly just an inconvenience for
a short while.  If the status was made unmoderated when it had been
previously moderated, it is a pretty small window before someone sends
through a message correcting the error.  For example when the fiasco
of a couple of months ago unmoderated a number of groups, two admins
(Gene and someone else whose name eludes me) sent out all the messages
necessary to correct the situation.  All I had to do in all of that
was rmgroup rec.games.rpg.

Insanity indeed.

Dave
--
 (setq mail '("tale@pawl.rpi.edu" "tale@itsgw.rpi.edu" "tale@rpitsmts.bitnet"))

clewis@eci386.uucp (Chris Lewis) (07/21/89)

In article <1989Jul16.050248.16940@vicom.com> lmb@vicom.COM (Larry Blair) writes:

>Creating newgroups and, particularly, changing the moderation status of
>existing groups automatically is insanity.  The default behavior should
>not execute newgroup commands.

It's not the default in B-news either!

I was wondering whether anybody would mention that...

I will freely admit that it's a little easier to find and uncomment
the NONEWSGROUPS during B-news installation than to know to look for
and find the source and change it in C-news, but that does beg one point:

Most novice administrators would leave NONEWSGROUPS off anyhow because
they don't have the slightest idea of what happens when they leave it off.

Even some non-novice administrators (like me - I contributed some of
bug reports that were actually accepted by Geoff (! ;-)) in C-news Alpha) 
*still* leave NONEWSGROUPS off.  I'll implement my automated "alt" 
group killer soon.... ;-)
-- 
Chris Lewis, R.H. Lathwell & Associates: Elegant Communications Inc.
UUCP: {uunet!mnetor, utcsri!utzoo}!lsuc!eci386!clewis
Phone: (416)-595-5425