Cancel articles without a hostname in its From-field
The Daemon's Slave
tim at Data-IO.COM
Wed Aug 3 01:39:09 AEST 1988
In article <452 at ssp15.idca.tds.philips.nl> jos at philapd.UUCP (Jos Vos) writes:
=> Because I want to hide our internal hosts, I use the feature offered
=> by the GENERICFROM string (news B 2.11.14).
=>
=> So, for example, i.s.o. "jos at ssp15.idca.tds.philips.nl" I become
=> "jos at idca.tds.philips.nl" in my From-field (b.t.w., this article will
=> have another From-field, due to some temporary reasons...).
=>
=> BUT: then I can't cancel my own articles anymore (at least, using the 'C'
=> command in rn), because it is not recognized anymore that I'm the sender
=> of the article.
=> (When the article contains the *full* hostname, the cancel succeeds.)
=>
I just had to fix this same problem last week. The patches here will fix
readnews, vnews, and rn. The rn fix was just to force the "SITENAME" to
the value of 2.11's GENERICFROM define, while vnews and readnews change
the value of the "user" to match the GENERICFROM so "user" would become
"user"@GENERICFROM before the compare occurs. This also seems to work
for NNTP but I haven't got around to extensive testing yet.
#!/bin/sh
#
# ################################################################### #
# --------CUT---------CUT---------CUT---------CUT--------CUT--------- #
# #
# This is a shell archive. These archives are packed by the program #
# packmail(1). If you have the program unshar(1), I suggest you use #
# it. If you don't, remove anything before the cut line and then #
# feed to sh(1). To extract files using the second method: #
# #
# 1) Make a directory for the files. #
# 2) Write a file, such as "file.shar", containing #
# this archive file into the directory. #
# 3) Type "sh file.shar". Do not use csh. #
# #
# ################################################################### #
#
#
#
echo 'Start of pack.out, part 01 of 01:'
echo 'x - news.DIFF'
sed 's/^X//' > news.DIFF << '/'
X*** readr.c.orig Tue Aug 2 08:04:26 1988
X--- readr.c Tue Aug 2 08:06:03 1988
X***************
X*** 646,656 ****
X--- 646,665 ----
X return FALSE;
X }
X
X+
X+ #ifdef GENERICPATH
X+ char luser[64];
X+ #endif /* GENERICPATH */
X cancel_command()
X {
X int notauthor;
X tfilename = filename;
X hptr = h;
X+ #ifdef GENERICPATH
X+ (void) strcpy(luser, GENERICPATH);
X+ (void) strcat(luser, "!");
X+ (void) strcat(luser, username);
X+ #endif /* GENERICPATH */
X if (*bptr == '-') {
X if (*ofilename1) {
X tfilename = ofilename1;
X***************
X*** 664,670 ****
X--- 673,683 ----
X ptr1 = index(rcbuf, ' ');
X if (ptr1)
X *ptr1 = 0;
X+ #ifndef GENERICPATH
X notauthor = STRCMP(username, rcbuf);
X+ #else /* GENERICPATH */
X+ notauthor = STRCMP(luser, rcbuf);
X+ #endif /*! GENERICPATH */
X if (uid != ROOTID && uid && notauthor) {
X fprintf(ofp, "Can't cancel what you didn't write.\n");
X return FALSE;
X*** visual.c.orig Tue Aug 2 08:04:58 1988
X--- visual.c Wed Jul 27 17:38:21 1988
X***************
X*** 947,967 ****
X }
X }
X
X cancel_command()
X {
X register char *poster, *r;
X int notauthor;
X char *senderof();
X
X poster = senderof(h);
X /* only compare up to '.' or ' ' */
X r = index(poster,'.');
X if (r == NULL)
X r = index(poster,' ');
X if (r != NULL)
X *r = '\0';
X- tfilename = filename;
X notauthor = STRCMP(username, poster);
X if (uid != ROOTID && uid && notauthor) {
X msg("Can't cancel what you didn't write.");
X return;
X--- 947,982 ----
X }
X }
X
X+ #ifdef GENERICFROM
X+ char luser[64];
X+ #endif /* GENERICFROM */
X cancel_command()
X {
X register char *poster, *r;
X int notauthor;
X char *senderof();
X+ #ifdef GENERICFROM
X+ (void) strcpy(luser, username);
X+ (void) strcat(luser, "@");
X+ (void) strcat(luser, GENERICFROM);
X+ #endif /* GENERICFROM */
X
X poster = senderof(h);
X /* only compare up to '.' or ' ' */
X+ #ifndef GENERICFROM
X r = index(poster,'.');
X if (r == NULL)
X r = index(poster,' ');
X if (r != NULL)
X *r = '\0';
X notauthor = STRCMP(username, poster);
X+ #else /* GENERICFROM */
X+ r = index(poster,' ');
X+ if (r != NULL)
X+ *r = '\0';
X+ notauthor = STRCMP(luser, poster);
X+ #endif /*! GENERICFROM */
X+ tfilename = filename;
X if (uid != ROOTID && uid && notauthor) {
X msg("Can't cancel what you didn't write.");
X return;
/
echo 'x - rn.DIFF'
sed 's/^X//' > rn.DIFF << '/'
X*** intrp.c.orig Tue Aug 2 08:10:21 1988
X--- intrp.c Tue Aug 2 08:15:38 1988
X***************
X*** 66,71 ****
X--- 66,76 ----
X # endif DOUNAME
X #endif GETHOSTNAME
X
X+ #ifdef GENERICFROM /* Define this in your makefile if */
X+ #undef SITENAME /* you use it in the news source. */
X+ #define SITENAME "Data-IO.COM" /* Set this to GENERICFROM which is */
X+ #endif /* defined in the 2.11 news source */
X+
X #ifdef TILDENAME
X static char *tildename = Nullch;
X static char *tildedir = Nullch;
/
echo 'Part 01 of pack.out complete.'
exit
--
<tim at Data-IO.COM> ..uunet Tim Rosmus (Sys Admin)
..sun!fluke----------\ | Data I/O Corporation
..uw-beaver------------!tikal!pilchuck!tim 10525 Willows Road N.E.
..decvax!microsoft---/ Redmond, WA (206)881-6444
More information about the Comp.sources.bugs
mailing list