1: #include "util.h"
   2: #include "mmdf.h"
   3: #ifndef POP
   4: 
   5: /*
   6:  *			   C H _ B B O A R D S . C
   7:  *
   8:  *			   the new BBoards channel
   9:  */
  10: 
  11: #else   POP
  12: 
  13: /*
  14:  *			       C H _ P O P . C
  15:  *
  16:  *			       the POP channel
  17:  */
  18: 
  19: #endif	POP
  20: 
  21: /*  */
  22: 
  23: #ifndef POP
  24: 
  25: /*
  26:  *	This is the channel that is used to handle Internet BBoard
  27:  *	distribution in an intelligent fashion.  In order to run it, you
  28:  *	need the UCI BBoards facility installed.  This requires the
  29:  *	establishment of a special login called ``bboards'', and the
  30:  *	getbbent() package.
  31:  *
  32:  *	The idea is simple.  Distribution lists get aliased to go through
  33:  *	this channel.  Suppose that the relay (or site) using ch_bboards
  34:  *	subscribes to UNIX-WIZARDS.  The maintainer of the list is given
  35:  *	the address ``dist-unix-wizards'' to send to for this relay and all
  36:  *	sites that it serves.  The site manager then defines the following
  37:  *	alias in the aliases file:
  38:  *
  39:  *		dist-unix-wizards:	unix-wizards@bboards
  40:  *
  41:  *	This channel (and this channel alone) is then defined to serve the
  42:  *	``bboards'' host.  When it gets invoked, the channel does two
  43:  *	things:  First, if the relay itself subscribes to the BBoard (the
  44:  *	bb_file entry in the BBoards file is non-empty), then it delivers
  45:  *	the message to the file.  Second, if other sites subscribe to the
  46:  *	BBoard, then ch_bboards will enter the message back into the queue
  47:  *	system using the ``bboards'' login as the sender.
  48:  *
  49:  *	This achieves two goals:  first, the incoming bandwidth of relays
  50:  *	is not degraded by many sites subscribing to the same BBoard;
  51:  *	second, if an address goes bad down the line, the relay's
  52:  *	``bboards'' login gets the message back (not the originator).  Since
  53:  *	the relay's PostMaster is assumed to monitor this mailbox, problems
  54:  *	can be found and corrected.
  55:  *
  56:  *	Finally, ch_bboards can be run by a site that does not relay for
  57:  *	other sites.  In this case, the bb_dist field is empty.
  58:  */
  59: 
  60: /* 	Unlike previous versions of ch_bboards, this version does not change
  61:  *	the contents of the headers of the message being re-distributed.
  62:  *	The following changes are made:
  63:  *
  64:  *	    Envelope:	The failure address is changed to bboards@locname
  65:  *	    Headers:	Another Received: is added
  66:  *
  67:  *	The local copy going to the BBoard has two entries prepended to the
  68:  *	headers:
  69:  *
  70:  *	    BBoard-ID: n
  71:  *	    BB-Posted: RFC822 date/time
  72:  */
  73: 
  74: #else   POP
  75: 
  76: /*
  77:  *	The POP channel is a subset of the BBoards channel, and just
  78:  *	handles local mail delivery for remote users.  As such, it
  79:  *	only needs to know how to store a maildrop locally, and doesn't
  80:  *	have to mess around with .cnt files and remote delivery.
  81:  */
  82: 
  83: #endif	POP
  84: 
  85: /*  */
  86: 
  87: #include <signal.h>
  88: #include "ch.h"
  89: #include "phs.h"
  90: 
  91: extern LLog chanlog;
  92: LLog   *logptr = &chanlog;
  93: extern char *logdfldir;
  94: 
  95: /*  */
  96: 
  97: main (argc, argv)
  98: int     argc;
  99: char  **argv;
 100: {
 101:     Chan    *chanptr;
 102:     char    *dupfpath ();
 103:     short   retval;
 104: 
 105:     mmdf_init (argv[0]);
 106: 
 107: #ifdef RUNALON
 108:     logptr -> ll_fd = 1;
 109:     ll_init (logptr);
 110: #endif
 111: 
 112:     siginit ();
 113:     signal (SIGINT, SIG_IGN);
 114: 
 115:     if ((chanptr = ch_nm2struct (argv[0])) == (Chan *) NOTOK)
 116:     err_abrt (RP_PARM, "unknown channel name '%s'", argv[0]);
 117: 
 118:     retval = ch_bboards (argc, argv, chanptr);
 119:     ll_close (logptr);
 120: 
 121:     exit (retval);
 122: }
 123: 
 124: /*  */
 125: /* ****************  (ch_) BBOARD DELIVERY **************** */
 126: 
 127: ch_bboards (argc, argv, chanptr)
 128: int     argc;
 129: char  **argv;
 130: Chan  *chanptr;
 131: {
 132: #ifdef  DEBUG
 133:     ll_log (logptr, LLOGBTR, "ch_bboards(argc=%d,*argv='%s')", argc, *argv);
 134: #endif
 135: 
 136:     if (rp_isbad (qu_init (argc, argv)))
 137:     return RP_NO;
 138:     if (rp_isbad (bb_init (chanptr)))
 139:     return RP_NO;
 140: 
 141:     phs_note (chanptr, PHS_WRSTRT);
 142: 
 143:     if (rp_isbad (qu2bb_send (chanptr)))
 144:     return RP_NO;
 145: 
 146:     phs_note (chanptr, PHS_WREND);
 147: 
 148:     qu_end (OK);
 149:     bb_end (OK);
 150: 
 151:     return RP_OK;
 152: }
 153: 
 154: /*  */
 155: 
 156: /* VARARGS2 */
 157: err_abrt (code, fmt, b, c, d)
 158: short   code;
 159: char   *fmt,
 160:        *b,
 161:        *c,
 162:        *d;
 163: {
 164:     char    linebuf[LINESIZE];
 165: 
 166:     qu_end (NOTOK);
 167:     bb_end (NOTOK);
 168: 
 169:     sprintf (linebuf, "%s%s", "err [ ABEND (%s) ]\t", fmt);
 170:     ll_log (logptr, LLOGFAT, linebuf, rp_valstr (code), b, c, d);
 171:     ll_close (logptr);
 172: 
 173:     exit (code);
 174: }

Defined functions

ch_bboards defined in line 127; used 1 times
err_abrt defined in line 157; used 6 times
main defined in line 97; never used
Last modified: 1986-04-21
Generated: 2016-12-26
Generated by src2html V0.67
page hit count: 881
Valid CSS Valid XHTML 1.0 Strict