🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: news.software.nntp
19 messages
19 total messages Started by Mach Thu, 19 Apr 2001 17:03
Cancelling articles from within a newsreader, was Re: Can someone make a delete button?
#51919
Author: Mach
Date: Thu, 19 Apr 2001 17:03
143 lines
5005 bytes
>   BuZZard:
>
>   I think along with k/f's, news readers should just have a "delete"
>   button.
>   You come across a post you dont like, one click and its gone.


If you happen to run INND, you can use the program at the bottom of
this article to (locally) cancel articles from within a news 
reader like Messenger.

In Messenger, you select the article(s) you wish to cancel, then
forward them as an attachment to newskill@your.news.server

You need to place a line similar to the following in your mail
server's alias file (/etc/mail/aliases ?):

   newskill:           "|/usr/local/bin/newskill"

You need to SUID /usr/local/bin/newskill to the User ID (UID) of 
an INND adminstrator (i.e. a user that can execute ctlinnd).

________________________________cut_________________________________

/*  This is newskill V1.0 written by mach (c) 2000        *
 *  EMail: mach@nym.alias.net                             *
 *  Feel free to copy and redistribute in terms of the    *
 *  GNU public license.                                   */

#ifndef lint
  static char *const rcsid = "$Id: newskill.c,v 0.1 2000/07/28 20:34:05 pb Exp $";
#endif /* lint */

static char *const version = "newskill 0.1";

#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>

#ifndef LOG_FACILITY
  #define LOG_FACILITY   LOG_LOCAL7
#endif /* LOG_FACILITY */

#define DONTCARE  -1
#define FALSE      0
#define TRUE       1

#define MAXLINELEN 1024

#define DEBUG

#ifdef DEBUG
  #include <assert.h>
  #define MESSAGE(s)  if (OptionDebug) syslog (LOG_NOTICE, (s))
  #define MESSAGE_1(s,a)  if (OptionDebug) syslog (LOG_NOTICE, (s), (a))
  #define MESSAGE_2(s,a,b)  if (OptionDebug) syslog (LOG_NOTICE,(s),(a),(b))
  #define MESSAGE_3(s,a,b,c)  if (OptionDebug) syslog (LOG_NOTICE,(s),(a),(b),(c))
  #define MESSAGE_4(s,a,b,c,d)  if (OptionDebug) syslog (LOG_NOTICE,(s),(a),(b),(c),(d))
  #define MESSAGE_5(s,a,b,c,d,e)  if (OptionDebug) syslog (LOG_NOTICE,(s),(a),(b),(c),(d),(e))
#else
  #define MESSAGE(s)
  #define MESSAGE_1(s,a)
  #define MESSAGE_2(s,a,b)
  #define MESSAGE_3(s,a,b,c)
  #define MESSAGE_4(s,a,b,c,d)
  #define MESSAGE_5(s,a,b,c,d,e)
#endif /* DEBUG */

static char OptionAction = FALSE;
static char OptionDebug = FALSE;

int main(int argc, char **argv) {
  int c;
  char cmdString[MAXLINELEN + 38];
  char msgIDHeader[] = {"Message-ID: "};
  char nl[MAXLINELEN];
  int nlLen;
  int returnVal;

  OptionAction = FALSE;
  OptionDebug = FALSE;

  while ((c = getopt(argc, argv, "ad")) != EOF) {
    switch (c) {
    case 'a':
      OptionAction = TRUE;
      break;
    case 'd':
      #ifdef DEBUG
        OptionDebug = TRUE;
      #endif
      break;
      #endif
      break;
    }
  }

  if (OptionAction) {
    openlog ("newskill", LOG_NDELAY, LOG_LOCAL7);
  } else {
    openlog ("newskill", LOG_NDELAY, LOG_LOCAL7);
  }

  /* find mailer's Message-ID */
  for (;;) {
    if (fgets(nl, sizeof nl, stdin) == NULL)
      return -1;
    if (strncmp(msgIDHeader, nl, sizeof msgIDHeader - 1) == 0) {
      nlLen = strlen(nl);
      if (nl[nlLen - 1] == '\n') { /* remove new line */
        nl[nlLen - 1] = 0;
      }
      sprintf(cmdString, "/usr/local/news/bin/ctlinnd cancel '%s'", &(nl[sizeofmsgIDHeader - 1]));
      MESSAGE(cmdString);
      returnVal = system(cmdString);
      if (returnVal == -1) {
        syslog (LOG_ERR, "Problem invoking: %s", cmdString);
      }
    }
  }

  for (;;) {
    if (fgets(nl, sizeof nl, stdin) == NULL)
      break;
    if (strncmp(msgIDHeader, nl, sizeof msgIDHeader - 1) == 0) {
      nlLen = strlen(nl);
      if (nl[nlLen - 1] == '\n') { /* remove new line */
        nl[nlLen - 1] = 0;
      }
      sprintf(cmdString, "/usr/local/news/bin/ctlinnd cancel '%s'", &(nl[sizeofmsgIDHeader - 1]));
      MESSAGE(cmdString);
      returnVal = system(cmdString);
      if (returnVal == -1) {
        syslog (LOG_ERR, "Problem invoking: %s", cmdString);
      }
    }
  }

  return 0;
}

Re: Cancelling articles from within a newsreader, was Re: Can someone make a delete button?
#51922
Author: Vampi Fangs
Date: Fri, 20 Apr 2001 00:24
26 lines
1248 bytes
On Thu, 19 Apr 2001 12:03:31 -0500, Mach <mach@xganon.com> enlightened us:

<snip>

as usual, very nice.... archived.... :)


-- 

V--V

http://www.bigfoot.com/~vfangs
http://www.petitmorte.net/graveyard/

Beware of a man's shadow and a bee's sting. 
Burmese Proverb 

Genius does what it must, talent does what it can.
Edward G. Bulwer-Lytton

Proud petitmorte poster and member of the official Howard Kk/f
                        
PGP Key ID: 0xADD8F27D
PGP Key Server: pgpkeys.mit.edu
                        
Re: Cancelling articles from within a newsreader, was Re: Can someone make a delete button?
#51933
Author: those who know me have no need o...
Date: Fri, 20 Apr 2001 02:08
16 lines
1218 bytes
<200104191703.MAA01793@www.xganon.com> divulged:

>If you happen to run INND, you can use the program at the bottom of
>this article to (locally) cancel articles from within a news 
>reader like Messenger.

cool.  now everyone knows how to cancel articles on your server, i.e.,
no authentication, and it's got a couple of spiffy holes just waiting to
let folks crack your newsadmin account.

that's not to say that such a tool is a bad idea.  it just needs more
work.

-- 
okay, have a sig then
Canceling articles from within a newsreader
#51925
Author: Mach
Date: Fri, 20 Apr 2001 03:32
171 lines
5774 bytes
>>  Mach:
>>  
>>  If you happen to run INND, you can use the program at the bottom of
>>  this article to (locally) cancel articles from within a news
>>  reader like Messenger.


My apologies Vampii. Newskill needs one more correction. :(

My code contains a glaring error. It never reaches the second
for loop because it stays in the first for loop until it reaches
the end of the email. It only coincidentally worked because
the first for loop invoked inndctl cancel against every
Message-ID that it read. 

The first for loop detects the very first Message-ID that appears
in the email. Sendmail puts the first Message-ID into the email as
a reference. Invoking a "ctlinnd cancel" against sendmail's 
MessageID accomplishes little, if anything. The program needs
to break out of the first for loop immediately after it spots
the very first MessageID.

Once again, the corrected source, version 0.21, appears at the
bottom of this followup.


>   not-a-real-address:
>   
>   cool.  now everyone knows how to cancel articles on your server, i.e.,
>   no authenticate, and it's got a couple of spiffy holes just waiting to
>   let folks crack your newsadmin account.


Will you help me raise newskill's version above 0.21?

Is it possible to use a cookie to authenticate email from Messenger?

Can you use procmail to secure it?

What security holes do you see?


>   that's not to say that such a tool is a bad idea.  it just needs more
>   work.


It attacks hip crime floods like nitric acid.


________________________________cut_________________________________

/*  This is newskill V0.21 written by mach (c) 2000        *
 *  EMail: mach@nym.alias.net                             *
 *  Feel free to copy and redistribute in terms of the    *
 *  GNU public license.                                   */

#ifndef lint
  static char *const rcsid = "$Id: newskill.c,v 0.21 2000/07/28 20:34:05 pb Exp $";
#endif /* lint */

static char *const version = "newskill 0.21";

#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>

#ifndef LOG_FACILITY
  #define LOG_FACILITY   LOG_LOCAL7
#endif /* LOG_FACILITY */

#define DONTCARE  -1
#define FALSE      0
#define TRUE       1

#define MAXLINELEN 1024

#define DEBUG

#ifdef DEBUG
  #include <assert.h>
  #define MESSAGE(s)  if (OptionDebug) syslog (LOG_NOTICE, (s))
  #define MESSAGE_1(s,a)  if (OptionDebug) syslog (LOG_NOTICE, (s), (a))
  #define MESSAGE_2(s,a,b)  if (OptionDebug) syslog (LOG_NOTICE,(s),(a),(b))
  #define MESSAGE_3(s,a,b,c)  if (OptionDebug) syslog (LOG_NOTICE,(s),(a),(b),(c))
  #define MESSAGE_4(s,a,b,c,d)  if (OptionDebug) syslog (LOG_NOTICE,(s),(a),(b),(c),(d))
  #define MESSAGE_5(s,a,b,c,d,e)  if (OptionDebug) syslog (LOG_NOTICE,(s),(a),(b),(c),(d),(e))
#else
  #define MESSAGE(s)
  #define MESSAGE_1(s,a)
  #define MESSAGE_2(s,a,b)
  #define MESSAGE_3(s,a,b,c)
  #define MESSAGE_4(s,a,b,c,d)
  #define MESSAGE_5(s,a,b,c,d,e)
#endif /* DEBUG */

static char OptionAction = FALSE;
static char OptionDebug = FALSE;

int main(int argc, char **argv) {
  int c;
  char cmdString[MAXLINELEN + 38];
  char msgIDHeader[] = {"Message-ID: "};
  char nl[MAXLINELEN];
  int nlLen;
  int returnVal;

  OptionAction = FALSE;
  OptionDebug = FALSE;

  while ((c = getopt(argc, argv, "ad")) != EOF) {
    switch (c) {
    case 'a':
      OptionAction = TRUE;
      break;
    case 'd':
      #ifdef DEBUG
        OptionDebug = TRUE;
      #endif
      break;
      #endif
      break;
    }
  }

  if (OptionAction) {
    openlog ("newskill", LOG_NDELAY, LOG_LOCAL7);
  } else {
    openlog ("newskill", LOG_NDELAY, LOG_LOCAL7);
  }

  /*
   * find sendmail's Message-ID (the very first Message-ID)
   * and ignore it
   */
  for (;;) {
    if (fgets(nl, sizeof nl, stdin) == NULL) {
      return -1;
    }
    if (strncmp(msgIDHeader, nl, sizeof msgIDHeader - 1) == 0) {
      /* we found the first Message-ID, break out of the for loop */
      break;
    }
  }

  /*
   * invoke ctlinnd cancel against all of the remaining
   * Message-IDs, attached to the email.
   */
  for (;;) {
    if (fgets(nl, sizeof nl, stdin) == NULL) {
      break;
    }
    if (strncmp(msgIDHeader, nl, sizeof msgIDHeader - 1) == 0) {
      nlLen = strlen(nl);
      if (nl[nlLen - 1] == '\n') { /* remove new line */
        nl[nlLen - 1] = 0;
      }
      sprintf(cmdString, "/usr/local/news/bin/ctlinnd cancel '%s'", &(nl[sizeofmsgIDHeader - 1]));
      MESSAGE(cmdString);
      returnVal = system(cmdString);
      if (returnVal == -1) {
        syslog (LOG_ERR, "Problem invoking: %s", cmdString);
      }
    }
  }

  return 0;
}

Canceling articles from within a newsreader
#51926
Author: Mach
Date: Fri, 20 Apr 2001 04:06
167 lines
5156 bytes

>>  Mach:
>>  
>>  If you happen to run INND, you can use the program at the bottom of
>>  this article to (locally) cancel articles from within a news
>>  reader like Messenger.


My code contains an error. You need to remove

      sprintf(cmdString, "/usr/local/news/bin/ctlinnd cancel '%s'", &(nl[sizeofmsgIDHeader - 1]));
      MESSAGE(cmdString);
      returnVal = system(cmdString);
      if (returnVal == -1) {
        syslog (LOG_ERR, "Problem invoking: %s", cmdString);
      }

from the first

   for (;;) {
   }

The first for loop detects the very first MessageID that appears
in the email. Sendmail puts the first MessageID into the email as
a reference. Invoking a "ctlinnd cancel" against sendmail's 
MessageID accomplishes little, if anything.

The corrected source appears at the bottom of this followup.


>   not-a-real-address:
>   
>   cool.  now everyone knows how to cancel articles on your server, i.e.,
>   no authenticate, and it's got a couple of spiffy holes just waiting to
>   let folks crack your newsadmin account.


Will you help me raise newskill's version above 0.2?

Is it possible to use a cookie to authenticate email from Messenger?

Can you use procmail to secure it?

What security holes do you see?


>   that's not to say that such a tool is a bad idea.  it just needs more
>   work.


It attacks hip crime floods like nitric acid.


________________________________cut_________________________________

/*  This is newskill V0.2 written by mach (c) 2000        *
 *  EMail: mach@nym.alias.net                             *
 *  Feel free to copy and redistribute in terms of the    *
 *  GNU public license.                                   */

#ifndef lint
  static char *const rcsid = "$Id: newskill.c,v 0.2 2000/07/28 20:34:05 pb Exp $";
#endif /* lint */

static char *const version = "newskill 0.2";

#include <stdio.h>
#include <stdlib.h>
#include <syslog.h>

#ifndef LOG_FACILITY
  #define LOG_FACILITY   LOG_LOCAL7
#endif /* LOG_FACILITY */

#define DONTCARE  -1
#define FALSE      0
#define TRUE       1

#define MAXLINELEN 1024

#define DEBUG

#ifdef DEBUG
  #include <assert.h>
  #define MESSAGE(s)  if (OptionDebug) syslog (LOG_NOTICE, (s))
  #define MESSAGE_1(s,a)  if (OptionDebug) syslog (LOG_NOTICE, (s), (a))
  #define MESSAGE_2(s,a,b)  if (OptionDebug) syslog (LOG_NOTICE,(s),(a),(b))
  #define MESSAGE_3(s,a,b,c)  if (OptionDebug) syslog (LOG_NOTICE,(s),(a),(b),(c))
  #define MESSAGE_4(s,a,b,c,d)  if (OptionDebug) syslog (LOG_NOTICE,(s),(a),(b),(c),(d))
  #define MESSAGE_5(s,a,b,c,d,e)  if (OptionDebug) syslog (LOG_NOTICE,(s),(a),(b),(c),(d),(e))
#else
  #define MESSAGE(s)
  #define MESSAGE_1(s,a)
  #define MESSAGE_2(s,a,b)
  #define MESSAGE_3(s,a,b,c)
  #define MESSAGE_4(s,a,b,c,d)
  #define MESSAGE_5(s,a,b,c,d,e)
#endif /* DEBUG */

static char OptionAction = FALSE;
static char OptionDebug = FALSE;

int main(int argc, char **argv) {
  int c;
  char cmdString[MAXLINELEN + 38];
  char msgIDHeader[] = {"Message-ID: "};
  char nl[MAXLINELEN];
  int nlLen;
  int returnVal;

  OptionAction = FALSE;
  OptionDebug = FALSE;

  while ((c = getopt(argc, argv, "ad")) != EOF) {
    switch (c) {
    case 'a':
      OptionAction = TRUE;
      break;
    case 'd':
      #ifdef DEBUG
        OptionDebug = TRUE;
      #endif
      break;
      #endif
      break;
    }
  }

  if (OptionAction) {
    openlog ("newskill", LOG_NDELAY, LOG_LOCAL7);
  } else {
    openlog ("newskill", LOG_NDELAY, LOG_LOCAL7);
  }

  /* find mailer's Message-ID */
  for (;;) {
    if (fgets(nl, sizeof nl, stdin) == NULL)
      return -1;
    if (strncmp(msgIDHeader, nl, sizeof msgIDHeader - 1) == 0) {
      nlLen = strlen(nl);
      if (nl[nlLen - 1] == '\n') { /* remove new line */
        nl[nlLen - 1] = 0;
      }
    }
  }

  for (;;) {
    if (fgets(nl, sizeof nl, stdin) == NULL)
      break;
    if (strncmp(msgIDHeader, nl, sizeof msgIDHeader - 1) == 0) {
      nlLen = strlen(nl);
      if (nl[nlLen - 1] == '\n') { /* remove new line */
        nl[nlLen - 1] = 0;
      }
      sprintf(cmdString, "/usr/local/news/bin/ctlinnd cancel '%s'", &(nl[sizeofmsgIDHeader - 1]));
      MESSAGE(cmdString);
      returnVal = system(cmdString);
      if (returnVal == -1) {
        syslog (LOG_ERR, "Problem invoking: %s", cmdString);
      }
    }
  }

  return 0;
}
Re: Canceling articles from within a newsreader
#51927
Author: Vampi Fangs
Date: Fri, 20 Apr 2001 04:19
27 lines
1784 bytes
On Thu, 19 Apr 2001 22:06:17 -0500, Mach <mach@xganon.com> enlightened us:

<snip>

noted and amended... ;)



-- 

V--V

http://www.bigfoot.com/~vfangs
http://www.petitmorte.net/graveyard/

Beware of a man's shadow and a bee's sting. 
Burmese Proverb 

Genius does what it must, talent does what it can.
Edward G. Bulwer-Lytton

Proud petitmorte poster and member of the official Howard Kk/f
                        
PGP Key ID: 0xADD8F27D
PGP Key Server: pgpkeys.mit.edu
                        
Re: Canceling articles from within a newsreader
#51929
Author: Vampi Fangs
Date: Fri, 20 Apr 2001 06:07
26 lines
1759 bytes
On Thu, 19 Apr 2001 22:32:17 -0500, Mach <mach@xganon.com> enlightened us:

<snip>

gotcha... no probs... ;)


-- 

V--V

http://www.bigfoot.com/~vfangs
http://www.petitmorte.net/graveyard/

Beware of a man's shadow and a bee's sting. 
Burmese Proverb 

Genius does what it must, talent does what it can.
Edward G. Bulwer-Lytton

Proud petitmorte poster and member of the official Howard Kk/f
                        
PGP Key ID: 0xADD8F27D
PGP Key Server: pgpkeys.mit.edu
                        
Re: Canceling articles from within a newsreader
#51934
Author: Andrew Stribblehill
Date: Fri, 20 Apr 2001 09:00
8 lines
1475 bytes
Wouldn't it be better if it cancelled message-IDs only in the body of
the message?

-- 
Andrew Stribblehill
Systems programmer, IT Service, University of Durham, England
Re: Canceling articles from within a newsreader
#51937
Author: BuZZard
Date: Fri, 20 Apr 2001 12:25
196 lines
7303 bytes
"Mach" <mach@xganon.com> wrote in message
news:200104200332.WAA31099@www.xganon.com...
>
> >>  Mach:
> >>
> >>  If you happen to run INND, you can use the program at the bottom of
> >>  this article to (locally) cancel articles from within a news
> >>  reader like Messenger.
>
>
> My apologies Vampii. Newskill needs one more correction. :(
>
> My code contains a glaring error. It never reaches the second
> for loop because it stays in the first for loop until it reaches
> the end of the email. It only coincidentally worked because
> the first for loop invoked inndctl cancel against every
> Message-ID that it read.
>
> The first for loop detects the very first Message-ID that appears
> in the email. Sendmail puts the first Message-ID into the email as
> a reference. Invoking a "ctlinnd cancel" against sendmail's
> MessageID accomplishes little, if anything. The program needs
> to break out of the first for loop immediately after it spots
> the very first MessageID.
>
> Once again, the corrected source, version 0.21, appears at the
> bottom of this followup.
>
>
> >   not-a-real-address:
> >
> >   cool.  now everyone knows how to cancel articles on your server, i.e.,
> >   no authenticate, and it's got a couple of spiffy holes just waiting to
> >   let folks crack your newsadmin account.
>
>
> Will you help me raise newskill's version above 0.21?
>
> Is it possible to use a cookie to authenticate email from Messenger?
>
> Can you use procmail to secure it?
>
> What security holes do you see?
>
>
> >   that's not to say that such a tool is a bad idea.  it just needs more
> >   work.
>
>
> It attacks hip crime floods like nitric acid.
>
>
> ________________________________cut_________________________________
>
> /*  This is newskill V0.21 written by mach (c) 2000        *
>  *  EMail: mach@nym.alias.net                             *
>  *  Feel free to copy and redistribute in terms of the    *
>  *  GNU public license.                                   */
>
> #ifndef lint
>   static char *const rcsid = "$Id: newskill.c,v 0.21 2000/07/28 20:34:05
pb Exp $";
> #endif /* lint */
>
> static char *const version = "newskill 0.21";
>
> #include <stdio.h>
> #include <stdlib.h>
> #include <syslog.h>
>
> #ifndef LOG_FACILITY
>   #define LOG_FACILITY   LOG_LOCAL7
> #endif /* LOG_FACILITY */
>
> #define DONTCARE  -1
> #define FALSE      0
> #define TRUE       1
>
> #define MAXLINELEN 1024
>
> #define DEBUG
>
> #ifdef DEBUG
>   #include <assert.h>
>   #define MESSAGE(s)  if (OptionDebug) syslog (LOG_NOTICE, (s))
>   #define MESSAGE_1(s,a)  if (OptionDebug) syslog (LOG_NOTICE, (s), (a))
>   #define MESSAGE_2(s,a,b)  if (OptionDebug) syslog
(LOG_NOTICE,(s),(a),(b))
>   #define MESSAGE_3(s,a,b,c)  if (OptionDebug) syslog
(LOG_NOTICE,(s),(a),(b),(c))
>   #define MESSAGE_4(s,a,b,c,d)  if (OptionDebug) syslog
(LOG_NOTICE,(s),(a),(b),(c),(d))
>   #define MESSAGE_5(s,a,b,c,d,e)  if (OptionDebug) syslog
(LOG_NOTICE,(s),(a),(b),(c),(d),(e))
> #else
>   #define MESSAGE(s)
>   #define MESSAGE_1(s,a)
>   #define MESSAGE_2(s,a,b)
>   #define MESSAGE_3(s,a,b,c)
>   #define MESSAGE_4(s,a,b,c,d)
>   #define MESSAGE_5(s,a,b,c,d,e)
> #endif /* DEBUG */
>
> static char OptionAction = FALSE;
> static char OptionDebug = FALSE;
>
> int main(int argc, char **argv) {
>   int c;
>   char cmdString[MAXLINELEN + 38];
>   char msgIDHeader[] = {"Message-ID: "};
>   char nl[MAXLINELEN];
>   int nlLen;
>   int returnVal;
>
>   OptionAction = FALSE;
>   OptionDebug = FALSE;
>
>   while ((c = getopt(argc, argv, "ad")) != EOF) {
>     switch (c) {
>     case 'a':
>       OptionAction = TRUE;
>       break;
>     case 'd':
>       #ifdef DEBUG
>         OptionDebug = TRUE;
>       #endif
>       break;
>       #endif
>       break;
>     }
>   }
>
>   if (OptionAction) {
>     openlog ("newskill", LOG_NDELAY, LOG_LOCAL7);
>   } else {
>     openlog ("newskill", LOG_NDELAY, LOG_LOCAL7);
>   }
>
>   /*
>    * find sendmail's Message-ID (the very first Message-ID)
>    * and ignore it
>    */
>   for (;;) {
>     if (fgets(nl, sizeof nl, stdin) == NULL) {
>       return -1;
>     }
>     if (strncmp(msgIDHeader, nl, sizeof msgIDHeader - 1) == 0) {
>       /* we found the first Message-ID, break out of the for loop */
>       break;
>     }
>   }
>
>   /*
>    * invoke ctlinnd cancel against all of the remaining
>    * Message-IDs, attached to the email.
>    */
>   for (;;) {
>     if (fgets(nl, sizeof nl, stdin) == NULL) {
>       break;
>     }
>     if (strncmp(msgIDHeader, nl, sizeof msgIDHeader - 1) == 0) {
>       nlLen = strlen(nl);
>       if (nl[nlLen - 1] == '\n') { /* remove new line */
>         nl[nlLen - 1] = 0;
>       }
>       sprintf(cmdString, "/usr/local/news/bin/ctlinnd cancel '%s'",
&(nl[sizeofmsgIDHeader - 1]));
>       MESSAGE(cmdString);
>       returnVal = system(cmdString);
>       if (returnVal == -1) {
>         syslog (LOG_ERR, "Problem invoking: %s", cmdString);
>       }
>     }
>   }
>
>   return 0;
> }
>

This cancels all messeges?  I mean cancels them
off USENET?  It kicks ass!!!

I was more interested in a simple "delete" button.
one that doesn't cancel them from USENET, but just off your
reader.  Lets say you read AHM for hacking info......  But you
got fuckheads like me that troll....Now you just want to delete
them so the next time you come back into AHM you don't have
to swim thru piles of old troll shizit to get back to a thread.
Of course I am talking about the outhouse exprss reader.
I do realize there are other readers out there, and psyko said Agent
has a delete button.  Maybe one day there will be a add-on or plug-in
delete button for OE.


Re: Canceling articles from within a newsreader
#51950
Author: The Archiver
Date: Sat, 21 Apr 2001 14:08
25 lines
1656 bytes
"BuZZard" <G�ꧧ@K�$$m��ZZ.fM�> wrote:

>Maybe one day there will be a add-on or plug-in
>delete button for OE.
>

Try 'Extra' 'Newsgroup-Filters'.
There you can define rules which 'cancels' unwanted content
and/or senders.

In the Usenet language this is not called 'cancelling' but 'filtering'.
The special word you use to indicate that you have added someone
to your killfile (a filter which hides a user) is:  * PLONK *  :-)
PLONK is the sound which is created by an eMail address which
falls on the ground of your killfile.

A newsgroup filter is a part of the newsreader which scans the
headers of the messages for keywords (or complex combinations
of them) and hides them for you.

HTH
-- 
The Archiver

Re: Canceling articles from within a newsreader
#51982
Author: Damien
Date: Sun, 22 Apr 2001 19:30
229 lines
7885 bytes
On Thu, 19 Apr 2001 22:32:17 -0500, Mach <mach@xganon.com> wrote:
>  
> >>  Mach:
> >>  
> >>  If you happen to run INND, you can use the program at the bottom of
> >>  this article to (locally) cancel articles from within a news
> >>  reader like Messenger.

> >   not-a-real-address:
> >   
> >   cool.  now everyone knows how to cancel articles on your server, i.e.,
> >   no authenticate, and it's got a couple of spiffy holes just waiting to
> >   let folks crack your newsadmin account.
>  
>  
>  Will you help me raise newskill's version above 0.21?
>  
>  Is it possible to use a cookie to authenticate email from Messenger?
>  
>  Can you use procmail to secure it?
>  
>  What security holes do you see?

>  It attacks hip crime floods like nitric acid.

I don't see how this is useful for flood.  It involves dealing with
the messages individually.

In general though, I don't like this approach at all Mach.  First off,
it's a setuid news admin program available for anyone in the run.
Never mind the fact that it has zero authentication, that can be
fixed.  But there really is no need to let Joe Internet have access to
it, when you can make it only available to local users.

That, and it's written in C++.  I really can't stand C/C++ and only
use it when I have too.  With that as a disclaimer, this program does
two things, finds the Message-ID's in the the body of an email, and
runs "ctlinnd cancel" on them.  Perl is much better suited for this,
making the whole thing easier to read and write aloowing you to focus
on avoiding the security holes not-a-vaild-address pointed out.

>  ________________________________cut_________________________________

[snip unimportant stuff]

>  int main(int argc, char **argv) {
>    int c;
>    char cmdString[MAXLINELEN + 38];
>    char msgIDHeader[] = {"Message-ID: "};
>    char nl[MAXLINELEN];
>    int nlLen;
>    int returnVal;
>  
>    OptionAction = FALSE;
>    OptionDebug = FALSE;
>  
>    while ((c = getopt(argc, argv, "ad")) != EOF) {
>      switch (c) {
>      case 'a':
>        OptionAction = TRUE;
>        break;
>      case 'd':
>        #ifdef DEBUG
>          OptionDebug = TRUE;
>        #endif
>        break;
>        #endif
>        break;
>      }
>    }

Interesting. . . your action switch does nothing.

>    if (OptionAction) {
>      openlog ("newskill", LOG_NDELAY, LOG_LOCAL7);
>    } else {
>      openlog ("newskill", LOG_NDELAY, LOG_LOCAL7);
>    }

This is just ugly.  I have two words for you, "regular" and
"expressions".

>    /*
>     * find sendmail's Message-ID (the very first Message-ID)
>     * and ignore it
>     */
>    for (;;) {
>      if (fgets(nl, sizeof nl, stdin) == NULL) {
>        return -1;
>      }
>      if (strncmp(msgIDHeader, nl, sizeof msgIDHeader - 1) == 0) {
>        /* we found the first Message-ID, break out of the for loop */
>        break;
>      }
>    }
>  
>    /*
>     * invoke ctlinnd cancel against all of the remaining
>     * Message-IDs, attached to the email.
>     */
>    for (;;) {
>      if (fgets(nl, sizeof nl, stdin) == NULL) {
>        break;
>      }
>      if (strncmp(msgIDHeader, nl, sizeof msgIDHeader - 1) == 0) {
>        nlLen = strlen(nl);
>        if (nl[nlLen - 1] == '\n') { /* remove new line */
>          nl[nlLen - 1] = 0;
>        }

This is probably one of the holes not-a-vaild-address was talking
about.  What keeps me from using this as a message id: 

"some-random-message-id'; nc -l -p 33173 > /bin/sh;'"

>        sprintf(cmdString, "/usr/local/news/bin/ctlinnd cancel '%s'", &(nl[sizeofmsgIDHeader - 1]));
>        MESSAGE(cmdString);
>        returnVal = system(cmdString);
>        if (returnVal == -1) {
>          syslog (LOG_ERR, "Problem invoking: %s", cmdString);
>        }
>      }
>    }
>  
>    return 0;
>  }

Here's a perl version of the same program.  It's untested, but it
should give you an idea of why C/C++ is evil, and unsuited for your
purpose. 
----newskill.pl---
#!/usr/bin/perl -wT
use strict;

##############################
#
# newskill.pl
#
# Cancels all news messages in the body of an email
# 
# Usage: pipe the email in to the program
#
# Bugs and Limitations: 
#   doesn't work if the message-id header of the offending email
#     covers more than one line. Multi-line headers are legal
#     according to rfc1036 but exceedingly rare for message-id headers
#
#  assumes the email has exactly one message-id header
##############################

# path to ctlind
my $ctlind = "/usr/local/news/bin/ctlinnd";
# path to logfile
my $logfile = "/dev/null";

my $found_mail_message_id = "";
open(LOGFILE, ">>$logfile");
while(<>){

    # is this line a message-id header?
    if(m/Message-ID:\ <(\W+?)>/x){
        # if we haven't found the mail id yet
        if(! $found_mail_message_id){     
	    $found_mail_message_id = "1";     # we have now
	# otherwise, this is a message-id of a news message
        }else{
	  # so cancel it
	  my $return_val = system($ctlinnd, "cancel", $1);
	  # and log if anything went wrong
	  if($return_val > 0){ print LOGFILE "Error cancelling $1\n"; }
	}
    }  
}
------------------

A better approach probably would have been to keep reading until we
get to a blank line.  After that we would know we are in the body of
the message.

But I wouldn't use this either for reasons given above.  slrn, my
nesreader of choice, has the ability to pipe articles to a program.
So I would have put newskill in /usr/local/bin/, setuid to the news
admin and written it something like this:

----newskill.pl---
#!/usr/bin/perl -wT
use strict;

##############################
#
# newskill.pl
#
# Cancels the news messages it recieves on STDIN
# 
# Bugs and Limitations: 
#   doesn't work if the message-id header of the offending email
#     covers more than one line. Multi-line headers are legal
#     according to rfc1036 but exceedingly rare for message-id headers
##############################

# path to ctlind
my $ctlind = "/usr/local/news/bin/ctlinnd";

while(<>){
    # find the message-id
    if(m/$Message-ID:\ <(\W+?)>/x){
        # and cancel it
	my $return_val = system($ctlinnd, "cancel", $1);
	# if anything went wrong, tell the user
	if($return_val > 0){ print "Error cancelling $1\n"; }
	# all done
	exit $return_val;
    }  
}
# no message id found, tell user
print "Cannot cancel article, no Message-ID header found.\n"
exit 8;
------------------

If the box you use to read news is different from your server, you can
probably use some ssh -c magic to make this work.

Unfortunatly I couldn't find a way to bind a key in slrn to pipe and
article to a particular program.  Maybe I'll put that in their
wish-list box.

HTH.
--Damien
Re: Canceling articles from within a newsreader
#52043
Author: user_
Date: Thu, 26 Apr 2001 09:22
207 lines
7657 bytes
OE main menu "View" > "Current view" > "Hide read or ignored messages", then
edit your toolbar to include the "Mark read" button, this becomes your
"delete" button.

"BuZZard" <G�ꧧ@K�$$m��ZZ.fM�> wrote in message
news:KUVD6.33$aC5.45022@paloalto-snr1.gtei.net...
>
> "Mach" <mach@xganon.com> wrote in message
> news:200104200332.WAA31099@www.xganon.com...
> >
> > >>  Mach:
> > >>
> > >>  If you happen to run INND, you can use the program at the bottom of
> > >>  this article to (locally) cancel articles from within a news
> > >>  reader like Messenger.
> >
> >
> > My apologies Vampii. Newskill needs one more correction. :(
> >
> > My code contains a glaring error. It never reaches the second
> > for loop because it stays in the first for loop until it reaches
> > the end of the email. It only coincidentally worked because
> > the first for loop invoked inndctl cancel against every
> > Message-ID that it read.
> >
> > The first for loop detects the very first Message-ID that appears
> > in the email. Sendmail puts the first Message-ID into the email as
> > a reference. Invoking a "ctlinnd cancel" against sendmail's
> > MessageID accomplishes little, if anything. The program needs
> > to break out of the first for loop immediately after it spots
> > the very first MessageID.
> >
> > Once again, the corrected source, version 0.21, appears at the
> > bottom of this followup.
> >
> >
> > >   not-a-real-address:
> > >
> > >   cool.  now everyone knows how to cancel articles on your server,
i.e.,
> > >   no authenticate, and it's got a couple of spiffy holes just waiting
to
> > >   let folks crack your newsadmin account.
> >
> >
> > Will you help me raise newskill's version above 0.21?
> >
> > Is it possible to use a cookie to authenticate email from Messenger?
> >
> > Can you use procmail to secure it?
> >
> > What security holes do you see?
> >
> >
> > >   that's not to say that such a tool is a bad idea.  it just needs
more
> > >   work.
> >
> >
> > It attacks hip crime floods like nitric acid.
> >
> >
> > ________________________________cut_________________________________
> >
> > /*  This is newskill V0.21 written by mach (c) 2000        *
> >  *  EMail: mach@nym.alias.net                             *
> >  *  Feel free to copy and redistribute in terms of the    *
> >  *  GNU public license.                                   */
> >
> > #ifndef lint
> >   static char *const rcsid = "$Id: newskill.c,v 0.21 2000/07/28 20:34:05
> pb Exp $";
> > #endif /* lint */
> >
> > static char *const version = "newskill 0.21";
> >
> > #include <stdio.h>
> > #include <stdlib.h>
> > #include <syslog.h>
> >
> > #ifndef LOG_FACILITY
> >   #define LOG_FACILITY   LOG_LOCAL7
> > #endif /* LOG_FACILITY */
> >
> > #define DONTCARE  -1
> > #define FALSE      0
> > #define TRUE       1
> >
> > #define MAXLINELEN 1024
> >
> > #define DEBUG
> >
> > #ifdef DEBUG
> >   #include <assert.h>
> >   #define MESSAGE(s)  if (OptionDebug) syslog (LOG_NOTICE, (s))
> >   #define MESSAGE_1(s,a)  if (OptionDebug) syslog (LOG_NOTICE, (s), (a))
> >   #define MESSAGE_2(s,a,b)  if (OptionDebug) syslog
> (LOG_NOTICE,(s),(a),(b))
> >   #define MESSAGE_3(s,a,b,c)  if (OptionDebug) syslog
> (LOG_NOTICE,(s),(a),(b),(c))
> >   #define MESSAGE_4(s,a,b,c,d)  if (OptionDebug) syslog
> (LOG_NOTICE,(s),(a),(b),(c),(d))
> >   #define MESSAGE_5(s,a,b,c,d,e)  if (OptionDebug) syslog
> (LOG_NOTICE,(s),(a),(b),(c),(d),(e))
> > #else
> >   #define MESSAGE(s)
> >   #define MESSAGE_1(s,a)
> >   #define MESSAGE_2(s,a,b)
> >   #define MESSAGE_3(s,a,b,c)
> >   #define MESSAGE_4(s,a,b,c,d)
> >   #define MESSAGE_5(s,a,b,c,d,e)
> > #endif /* DEBUG */
> >
> > static char OptionAction = FALSE;
> > static char OptionDebug = FALSE;
> >
> > int main(int argc, char **argv) {
> >   int c;
> >   char cmdString[MAXLINELEN + 38];
> >   char msgIDHeader[] = {"Message-ID: "};
> >   char nl[MAXLINELEN];
> >   int nlLen;
> >   int returnVal;
> >
> >   OptionAction = FALSE;
> >   OptionDebug = FALSE;
> >
> >   while ((c = getopt(argc, argv, "ad")) != EOF) {
> >     switch (c) {
> >     case 'a':
> >       OptionAction = TRUE;
> >       break;
> >     case 'd':
> >       #ifdef DEBUG
> >         OptionDebug = TRUE;
> >       #endif
> >       break;
> >       #endif
> >       break;
> >     }
> >   }
> >
> >   if (OptionAction) {
> >     openlog ("newskill", LOG_NDELAY, LOG_LOCAL7);
> >   } else {
> >     openlog ("newskill", LOG_NDELAY, LOG_LOCAL7);
> >   }
> >
> >   /*
> >    * find sendmail's Message-ID (the very first Message-ID)
> >    * and ignore it
> >    */
> >   for (;;) {
> >     if (fgets(nl, sizeof nl, stdin) == NULL) {
> >       return -1;
> >     }
> >     if (strncmp(msgIDHeader, nl, sizeof msgIDHeader - 1) == 0) {
> >       /* we found the first Message-ID, break out of the for loop */
> >       break;
> >     }
> >   }
> >
> >   /*
> >    * invoke ctlinnd cancel against all of the remaining
> >    * Message-IDs, attached to the email.
> >    */
> >   for (;;) {
> >     if (fgets(nl, sizeof nl, stdin) == NULL) {
> >       break;
> >     }
> >     if (strncmp(msgIDHeader, nl, sizeof msgIDHeader - 1) == 0) {
> >       nlLen = strlen(nl);
> >       if (nl[nlLen - 1] == '\n') { /* remove new line */
> >         nl[nlLen - 1] = 0;
> >       }
> >       sprintf(cmdString, "/usr/local/news/bin/ctlinnd cancel '%s'",
> &(nl[sizeofmsgIDHeader - 1]));
> >       MESSAGE(cmdString);
> >       returnVal = system(cmdString);
> >       if (returnVal == -1) {
> >         syslog (LOG_ERR, "Problem invoking: %s", cmdString);
> >       }
> >     }
> >   }
> >
> >   return 0;
> > }
> >
>
> This cancels all messeges?  I mean cancels them
> off USENET?  It kicks ass!!!
>
> I was more interested in a simple "delete" button.
> one that doesn't cancel them from USENET, but just off your
> reader.  Lets say you read AHM for hacking info......  But you
> got fuckheads like me that troll....Now you just want to delete
> them so the next time you come back into AHM you don't have
> to swim thru piles of old troll shizit to get back to a thread.
> Of course I am talking about the outhouse exprss reader.
> I do realize there are other readers out there, and psyko said Agent
> has a delete button.  Maybe one day there will be a add-on or plug-in
> delete button for OE.
>
>


Re: Canceling articles from within a newsreader
#52082
Author: those who know me have no need o...
Date: Sun, 29 Apr 2001 06:07
28 lines
1798 bytes
<200104200306.WAA26690@www.xganon.com> divulged:
[slightly rearranged]

>What security holes do you see?

using e-mail.

but if you continue along those lines ...

>Can you use procmail to secure it?

sign (or even better encrypt and sign) the message and have procmail
drop any message that doesn't verify.  those that verify can be passed
to your program.  and change keys from time to time.

>      returnVal = system(cmdString);

use one of the exec(2) variants.

create an account, that cannot login and is part of the news group,
rather that just using an alias.  (this isn't ideal, but it's better
than running it as news or root.)

use a chroot jail.

-- 
okay, have a sig then
Re: Canceling articles from within a newsreader
#52083
Author: those who know me have no need o...
Date: Sun, 29 Apr 2001 07:19
41 lines
2353 bytes
<3ae33166$0$1917$b45e6eb0@senator-bedfellow.mit.edu> divulged:

>This is just ugly.  I have two words for you, "regular" and
>"expressions".

as an aside:  what the hell were you talking about?  you look like
you've top posted within the body of the article.  _that_ is ugly.

>>      if (fgets(nl, sizeof nl, stdin) == NULL) {

all these should probably check for long lines.

>>      if (strncmp(msgIDHeader, nl, sizeof msgIDHeader - 1) == 0) {

all these should be case insensitive.  if you _know_ that the case will
always be as expected it's not a big deal.

># path to logfile
>my $logfile = "/dev/null";

why didn't you at least give the same functionality as was originally
present, i.e., syslog?  it's trivial, even in perl.

>    # is this line a message-id header?
>    if(m/Message-ID:\ <(\W+?)>/x){

this pattern isn't sufficient.  use /message-id:\s+<(.+)>/i instead,
with a leading ^\s* if it's supposed to be the only thing on the line.

also, why extended?  you didn't use comments or multi-line, the only
thing it did was force you to quote the space.

>        if(! $found_mail_message_id){     
>	    $found_mail_message_id = "1";     # we have now

talk about unclear or ugly programming.  mixing strings and boolean
expressions, and content flagging rather than structure recognition.

-- 
okay, have a sig then
Re: Canceling articles from within a newsreader
#52086
Author: Damien
Date: Sun, 29 Apr 2001 14:26
53 lines
3291 bytes
On Sun, 29 Apr 2001 07:19:29 -0000, those who know me have no need of
my name <not-a-real-address@usa.net> wrote:

> ># path to logfile
> >my $logfile = "/dev/null";
>  
>  why didn't you at least give the same functionality as was originally
>  present, i.e., syslog?  it's trivial, even in perl.

I didn't remember how it was done.  Patches are appreciated.  (Even if
I will never actually run this program.)

> >    # is this line a message-id header?
> >    if(m/Message-ID:\ <(\W+?)>/x){

>  this pattern isn't sufficient.  use /message-id:\s+<(.+)>/i instead,
>  with a leading ^\s* if it's supposed to be the only thing on the line.

That pattern is a typo.  It should have been /Message-ID:\ <(\S+?)>/x
instead.  I left out the ^\s* because the message may have been
quoted.  A better pattern might be /Message-ID:\s+<([^ >])>/, but the
[^ >] is overly complicated and only important with broken message-id
headers.

RFC 1036 is case consistant, although not explicitly case sensitive,
so case sensitivity is a matter of ambiguity.

(\S+?) as opposed to (\.+) weeds out more broken message-id, without
adding as much complexity as ([^ >]).

>  also, why extended?  you didn't use comments or multi-line, the only
>  thing it did was force you to quote the space.

I was toying with the idea of always using extended regular
expressions, since they usually improve readability.  Alas, sometimes
they don't, and they probably shouldn't be used in those cases.

> >        if(! $found_mail_message_id){     
> >	    $found_mail_message_id = "1";     # we have now

>  talk about unclear or ugly programming.  mixing strings and boolean
>  expressions, and content flagging rather than structure recognition.

Mixing strings and booleans is a common Perl idiom.  "Strong
typecasting is for those with weak minds."  

Content flagging vs Structure recognition was an unfortunate
carry-over from Mach's code.  As a side effect, a gibberish post
containing a lot of valid message ID's will probably cause a lot of
valid messages to be canceled.  But structure recognition when more
than one post could be contained in one message is more work than I'm
willing to do for free.
Re: Canceling articles from within a newsreader
#52089
Author: those who know me have no need o...
Date: Sun, 29 Apr 2001 20:54
29 lines
2016 bytes
<3aec24a5$0$1915$b45e6eb0@senator-bedfellow.mit.edu> divulged:

>I didn't remember how it was done.  Patches are appreciated.  (Even if
>I will never actually run this program.)

``man Sys::Syslog''.  one uses, then openlog instead of open, and syslog 
instead of print.

>That pattern is a typo.  It should have been /Message-ID:\ <(\S+?)>/x
>instead.  

ah.  much better.  except that the ": " should be ":\s+" if you want to 
comply with the bnf.

>RFC 1036 is case consistant, although not explicitly case sensitive,
>so case sensitivity is a matter of ambiguity.

it is explicitly case insensitive.

>Mixing strings and booleans is a common Perl idiom.  "Strong
>typecasting is for those with weak minds."  

exactly my point.  perl folks believe that it is somehow not ugly.  most 
other language aficionados disagree, i.e., it was a religious argument 
without any other (apparent) merit.

-- 
okay, have a sig then
Re: Canceling articles from within a newsreader
#52356
Author: Damien
Date: Wed, 16 May 2001 21:29
22 lines
1940 bytes
Three weeks later . . . .

On Sun, 29 Apr 2001 20:54:19 -0000, those who know me have no need of
my name <not-a-real-address@usa.net> wrote:
> <3aec24a5$0$1915$b45e6eb0@senator-bedfellow.mit.edu> divulged:

> >That pattern is a typo.  It should have been /Message-ID:\ <(\S+?)>/x
> >instead.  
>  
>  ah.  much better.  except that the ": " should be ":\s+" if you want to 
>  comply with the bnf.

What is the bnf?

> >RFC 1036 is case consistant, although not explicitly case sensitive,
> >so case sensitivity is a matter of ambiguity.
>  
>  it is explicitly case insensitive.

I thought it should be, but I couldn't find anything that said that.
Where did you get that from?
Re: Canceling articles from within a newsreader
#52394
Author: those who know me have no need o...
Date: Fri, 18 May 2001 16:22
22 lines
1946 bytes
<3b02f12b$0$1911$b45e6eb0@senator-bedfellow.mit.edu> divulged:

>What is the bnf?

a formal defintion of a language's grammar and syntax.  it's often
enumerated at the end of the standard, though some start right out with
it.  rfc 1036 doesn't have such a definition, since for the most part it
is drawing on previous work where such is present.

>> >RFC 1036 is case consistant, although not explicitly case sensitive,
>> >so case sensitivity is a matter of ambiguity.
>>  
>>  it is explicitly case insensitive.
>
>I thought it should be, but I couldn't find anything that said that.
>Where did you get that from?

rfc 822 3.4.7, by reference (or some would say, inference).

-- 
okay, have a sig then
Re: Canceling articles from within a newsreader
#52469
Author: Damien
Date: Wed, 23 May 2001 17:40
20 lines
1942 bytes
On Fri, 18 May 2001 16:22:10 -0000, those who know me have no need of
my name <not-a-real-address@usa.net> wrote:

> >> >RFC 1036 is case consistant, although not explicitly case sensitive,
> >> >so case sensitivity is a matter of ambiguity.

> >>  it is explicitly case insensitive.

> >I thought it should be, but I couldn't find anything that said that.
> >Where did you get that from?

>  rfc 822 3.4.7, by reference (or some would say, inference).

"Therefore, the rule is adopted that all USENET news messages must be
formatted as valid Internet mail messages, according to the Internet
standard RFC-822."

A very easy sentence to overlook.  I stand corrected.

Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads