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