[net.sources] anonymousity & inews.c

evans@wivax.UUCP (Barry Evans) (11/18/83)

Hello all.

I have some changes for inews and postnews, below, which some sites may wish
to incorporate for anonymous postings to net.motss.  [note: *ONLY* net.motss]
I was hesitant to distribute these changes bacause I don't really think people
should be able to submit anonymously, but in the case of net.motss I feel
that this option is a needed one (I won't go into details, but if you need
to know what they are, just ask.)

The changes to inews allow a user to call inews with a '-A' option that will
change the user's path to {site}!motss, and the .signature file will be
automaticaly skipped over.  There are no other differences.  I also included a
full listing of my postnews script, which interfaces with the -A option nicely.
The changes to postnews really aren't needed, but it's easier for people to
work with postnews than with inews.

This method will not allow return mail, unless you add a 'motss' pseudo-user
to your aliases file similar to this:
	motss: "| cat >> /usr/spool/mail/motss"
Any and all replies to anonymous articles will be spooled into this file
where it can be read by system users (be sure the file is created with a
system read mode (it should be)).

What to do:  (generally)
    o	add mods to inews.c
    o	add mods to postnews (or put them in localize.sh if you use it)
    o	run 'make' on it
    o	install the new version
    o	add a 'motss' pseudo-user to your aliases
    o	run newaliases program
simple, eh?

[Notice: I have this working on a vax11/780 running 4.1bsd with news 2.10.1]

***** inews.c *****
< old
> new
***************
2a3,6
>  *
>  * Barry Evans (wivax!evans)
>  * 10/12/83	Add code for forgedpath to DEFID (for annonymous
>  *		postings motss only)
12a17,18
> #define DEFID	"motss"		/* default for forged id */
> #define DEFAGRP	"net.motss"	/* default group for forged path */
23a30
> char	forgedpath[100];	/* A user specified -A option */
45a53,54
> #define Aflag	options[10].flag
> 'A',	'\0',		FALSE,	UNPROC,	UNKNOWN,	forgedpath,
193c202
< 			fprintf(stderr, "\t[ -f sender]\n\n");
---
> 			fprintf(stderr, "\t[ -f sender] [ -A ]\n\n");
316a326,332
> 		if (Aflag && (!strcmp(header.nbuf,strcat(DEFAGRP,",")))) {
> 			strcpy(header.from, "Annonymous");
> 			sprintf(header.sender, "%s@%s%s",
> 			    DEFID, SYSNAME, MYDOMAIN);
> 			sprintf(header.path, "%s!%s",SYSNAME,DEFID);
> 			printf("Default id (%s) has been substituted.\n",DEFID);
> 		}
677,684c693,705
< 	sprintf(bfr, "%s/%s", getenv("HOME"), ".signature");
< 	if (mode != PROC && (infp = fopen(bfr, "r"))) {
< 		fprintf(tmpfp, "-- \n");	/* To separate */
< 		linecount++;
< 		while ((c = getc(infp)) != EOF) {
< 			putc(c, tmpfp);
< 			if (c == '\n')
< 				linecount++;
---
> 	if (Aflag && (!strcmp(header.nbuf,strcat(DEFAGRP,",")))) {
> 		printf("(Skipping .signature file)\n");
> 	} else {
> 		sprintf(bfr, "%s/%s", getenv("HOME"), ".signature");
> 		if (mode != PROC && (infp = fopen(bfr, "r"))) {
> 			fprintf(tmpfp, "-- \n");	/* To separate */
> 			linecount++;
> 			while ((c = getc(infp)) != EOF) {
> 				putc(c, tmpfp);
> 				if (c == '\n')
> 					linecount++;
> 			}
> 			fclose(infp);
686d706
< 		fclose(infp);
***** end of inews.c mods *****

*****   Script listing of modified postnews *****
	: '@(#)postnews.v7	2.8	4/23/83'
	if test $# -gt 1 ; then
		/bin/echo "$0: Too many args"
		exit 1
	fi
	if test $# -eq 1 -a ! -r "$1" ; then
		/bin/echo "$0: Can't read $1"
		exit 1
	fi
	/bin/echo -n "Subject: "
	read title
	/bin/echo -n "Newsgroups (general): "
	read ng
+	if test x$ng = xnet.motss ; then
+	    /bin/echo -n "Post anonymously [no]: "
+	    read anon
+	    case $anon in
+	    yes|ye|y|YES|YE|Y)
+		anon="-A";;
+	    *)
+		anon="";;
+	    esac
+    	fi
	if test x$ng = x ; then
		ng=general
	fi
	/bin/echo -n "Distribution ($ng): "
	read dist
	if test x$dist = x; then
		dist=$ng
	fi
	t=/tmp/pn$$
	case $# in
	0)
		trap "sleep 1; cp $t $HOME/dead.article ; echo saved in $HOME/dead.article ; rm -f $t; exit" 1
		trap "" 2
		/bin/echo "Subject: $title" > $t
		/bin/echo "Newsgroups: $ng" >> $t
		if test $dist != $ng; then
			/bin/echo "Distribution: $dist" >> $t
		fi
		/bin/echo "" >> $t
		${EDITOR-vi} $t
		cd /tmp
+		if inews -h $anon <$t
		then
			:
		else
			if cat $t >>$HOME/dead.article
			then
				/bin/echo Article saved in $HOME/dead.article
			fi
		fi
		;;
	1)
		cp $1 $t
		cd /tmp
+		inews -t "$title" -n $ng $anon < $t
		;;
	esac
	sleep 1
	rm -f $t
***** end of postnews *****

have fun
ps.  as always, questions/comments/criticisms are welcome (most of the time).
-barry
-- 
Barry Evans   {decvax,linus}!wivax!evans
              Wang Institute (617) 649-9731 x383