From:	ADVAX::"mcnc!VM1.NoDak.EDU!cctr127%CSC.CANTERBURY.AC.NZ" "Jason Haar, NEWS Manager" 10-APR-1991 03:30:26.92
To:	Multiple recipients of list ANU-NEWS <ANU-NEWS@NDSUVM1>
CC:	
Subj:	Source code for NEWS/CAPTIVE

Received: by ADVAX.DECnet (utk-mail11 v1.5) ; Wed, 10 Apr 91 04:26:30 EDT
Received:  from mcnc by ge-dab.GE.COM (5.61/GE-DAB 1.15) with UUCP
	id AA01794 for ; Wed, 10 Apr 91 03:49:30 -0400
Received: from VM1.NoDak.EDU by mcnc.mcnc.org (5.59/MCNC/3-21-91)
	id AA13466; Tue, 9 Apr 91 17:50:16 -0400
	for ARISIA.DNET.ge.com!EVERHART
Message-Id: <9104092150.AA13466@mcnc.mcnc.org>
Received: from NDSUVM1.BITNET by VM1.NoDak.EDU (IBM VM SMTP R1.2.1MX) with BSMTP id 2102; Tue, 09 Apr 91 16:49:28 CDT
Received: from NDSUVM1.BITNET by NDSUVM1.BITNET (Mailer R2.07) with BSMTP id
 3349; Tue, 09 Apr 91 16:49:14 CDT
Date:         Wed, 10 Apr 91 09:17:24 +1200
Reply-To: "Jason Haar, NEWS Manager" <mcnc!VM1.NoDak.EDU!cctr127%CSC.CANTERBURY.AC.NZ>
Sender: ANU-NEWS Discussion <ANU-NEWS@VM1.NoDak.EDU>
From: "Jason Haar, NEWS Manager" <mcnc!VM1.NoDak.EDU!cctr127%CSC.CANTERBURY.AC.NZ>
Subject:      Source code for NEWS/CAPTIVE
To: Multiple recipients of list ANU-NEWS <ANU-NEWS@NDSUVM1>
 
Well then I might as well give further information and the source code changes
then...
 
The disabled commands just return without doing anything when they are
"invoked". I was thinking of including error messages, but Geoff doesn't
within the /READONLY option, so I thought I'd be consistant. The only slight
bug I've found is that when you type a PRINT command, it does return a error
status "Print: no items selected" - I've tried to disable this, but my C
programming experience is minimal, so I'm sure I've just positioned my changes
incorrectly.
 
As far as the actual account goes. Our one is set up as follows:
 
Login Flags:  Disctly Restricted Disnewmail Dismail Captive
Access limited to Local and Remote
Prclm = 0 (this stop spawning)
 
 
The account is set up with no WRITE protection for owner
 
i.e. SET PROT=O:RE NEWSREADER.DIR
 
This enables you to forget about NEWSRC. altogether. Our NEWSRC. file is read
in by every session starting up, and when they exit, nothing can be written -
so the original remains. The file just contains our local newsgroups and
news.announce.newusers - a file with only 5 lines in it (in our case). This is
working fine - no file-access problems or anything. So the account needs to
contain only two files, NEWSRC. and LOGIN.COM.
 
Below are the changes I've made to the NEWS code - I've reported in the form
 
$ SEARCH/WINDOW=8 * captive
 
--------
sea/w=8 NEWS.C,NEWSCMD.CLD,NEWSEXTRACT.C,NEWSFORWARD.C,NEWSPOST.C,NEWSREAD.C,NEW
SSEARCH.C,NEWSVARIABLES.H captive
 
******************************
$1$DUA6:[NEWSMGR.NEWS.NEWS_SRC]NEWS.C;93
 
      }
 
/*
 * Below initialises the NEWS/CAPTIVE command and makes it take on the
 * functionality of NEWS/READONLY too
 */
    if (cli$present(c$dsc("CAPTIVE")) & 1) {
        news_captive = 1;
        news_readonly = 1;
        }
    if (cli$present(c$dsc("READONLY")) & 1) news_readonly = 1;
    if (cli$present(c$dsc("ALLSCAN")) & 1) {
 
******************************
$1$DUA6:[NEWSMGR.NEWS.NEWS_SRC]NEWSCMD.CLD;124
 
    qualifier   SCAN        value(list)
    qualifier   UNSEEN
    qualifier   READONLY
    qualifier   CAPTIVE
    qualifier   CLASS       value
    qualifier   NETSERVER   negatable,value
    qualifier   NETPROTOCOL nonnegatable,value(required,type=PROTOCOL_OPTIONS)
    parameter   P1          label=COMMAND,value(type=$rest_of_line)
 
******************************
$1$DUA6:[NEWSMGR.NEWS.NEWS_SRC]NEWSEXTRACT.C;157
 
  unsigned short i_len;
  $DESCRIPTOR(idsc,input_line);
 
/* Next line stops PRINT command working for NEWS/CAPTIVE */
  if (news_captive) return(0);
 
  if (!confirm_specified) return(FQM_ACCESS);
  sprintf(prompt,"%s, Print? [N]",p);
 
***************
{
  unsigned short ofnam_len = 0;
 
/* Next line stops EXTRACT command working for NEWS/CAPTIVE */
  if (news_captive) return(0);
  fpextract = 0;
  n_extracted = 0;
  append_ofile = (cli$present(c$dsc("APPEND")) & 1);
  m_seen = (cli$present(c$dsc("SEEN")) & 1);
 
******************************
$1$DUA6:[NEWSMGR.NEWS.NEWS_SRC]NEWSFORWARD.C;64
 
  $DESCRIPTOR(ngroup_dsc,ngroup);
  struct stat sbuffer;
 
 /* Next line stops MAIL/FORW/REPLY commands working for NEWS/CAPTIVE */
  if (news_captive) return(0);
 
  if ((!curr_g) || (curr_i <= 0)) {
    err_line("Error: Mailer - No item located to mail");
    return(0);
***************
  $DESCRIPTOR(ngroup_dsc,ngroup);
  $DESCRIPTOR(infile_dsc,infile);
 
 /* Next line stops SEND command working for NEWS/CAPTIVE */
  if (news_captive) return(0);
 
  *subj = *address = '\0';
  if (!(fpw = fopen(Mail_file,"w","rat=cr","rfm=var"))) {
    err_line("Error: Send - cannot open tmp output file");
 
******************************
$1$DUA6:[NEWSMGR.NEWS.NEWS_SRC]NEWSPOST.C;165
 
  char tpucallstr[100];
  int save_vd;
 
  if (news_captive) return(0);
  if (*Editor) strcpy(tpucallstr,Editor);
  else strcpy(tpucallstr,"TPU");
  strcat(tpucallstr," ");
  strcat(tpucallstr,infile);
 
******************************
$1$DUA6:[NEWSMGR.NEWS.NEWS_SRC]NEWSREAD.C;106
 
  if (cli$present(c$dsc("HEADER")) & 1) h = 1;
  if (cli$present(c$dsc("TPU")) & 1) tpucall = 1;
  if (cli$present(c$dsc("EDITOR")) & 1) tpucall = 1;
/* JLH Stop READ EDITOR working within /CAPTIVE */
  if (news_captive) tpucall = 0;
  else if (cli$present(c$dsc("ROT13")) & 1) rot13 = 1;
  c$cks(1);
  if (cli$present(c$dsc("FOLLOWUP")) & 1) {
    do_readfollow(h,rot13,(cli$present(c$dsc("NEW")) & 1));
***************
  if (cli$present(c$dsc("HEADER")) & 1) h = 1;
  if (cli$present(c$dsc("TPU")) & 1) tpucall = 1;
  if (cli$present(c$dsc("EDITOR")) & 1) tpucall = 1;
/* JLH Stop READ EDITOR working within /CAPTIVE */
  if (news_captive) tpucall = 0;
  else if (cli$present(c$dsc("ROT13")) & 1) rot13 = 1;
  if ((news_context > 1) && curr_g && (curr_i > 0)) {
    if (curr_i < ga[curr_g]->grp_count) {
      st_h = h; st_tpu = tpucall; st_r13 = rot13;
***************
    if (cli$present(c$dsc("HEADER")) & 1) h = 1;
    if (cli$present(c$dsc("TPU")) & 1) tpucall = 1;
    if (cli$present(c$dsc("EDITOR")) & 1) tpucall = 1;
/* JLH Stop READ EDITOR working within /CAPTIVE */
  if (news_captive) tpucall = 0;
    else if (cli$present(c$dsc("ROT13")) & 1) rot13 = 1;
  if ((news_context > 1) && curr_g && (curr_i > 0))
    return(do_readfollow(h,rot13,0),0);
  else err_line("NEXT: No newsgroup open");
***************
    if (cli$present(c$dsc("HEADER")) & 1) h = 1;
    if (cli$present(c$dsc("TPU")) & 1) tpucall = 1;
    if (cli$present(c$dsc("EDITOR")) & 1) tpucall = 1;
/* JLH Stop READ EDITOR working within /CAPTIVE */
  if (news_captive) tpucall = 0;
    else if (cli$present(c$dsc("ROT13")) & 1) rot13 = 1;
  return(do_readnew(h,rot13,0),0);
}
 
***************
  if (cli$present(c$dsc("HEADER")) & 1) h = 1;
  if (cli$present(c$dsc("TPU")) & 1) tpucall = 1;
  if (cli$present(c$dsc("EDITOR")) & 1) tpucall = 1;
/* JLH Stop READ EDITOR working within /CAPTIVE */
  if (news_captive) tpucall = 0;
  else if (cli$present(c$dsc("ROT13")) & 1) rot13 = 1;
  if ((news_context > 1) && curr_g && (curr_i > 0)) {
    if (curr_i > 1) {
      st_h = h; st_tpu = tpucall; st_r13 = rot13;
***************
  if (cli$present(c$dsc("HEADER")) & 1) h = 1;
  if (cli$present(c$dsc("TPU")) & 1) tpucall = 1;
  if (cli$present(c$dsc("EDITOR")) & 1) tpucall = 1;
/* JLH Stop READ EDITOR working within /CAPTIVE */
  if (news_captive) tpucall = 0;
  else if (cli$present(c$dsc("ROT13")) & 1) rot13 = 1;
  if ((news_context > 1) && curr_g && (curr_i > 0))
    return(do_readparent(h,rot13),0);
  else err_line("BACK: No newsgroup open");
***************
  if (cli$present(c$dsc("HEADER")) & 1) h = 1;
  if (cli$present(c$dsc("TPU")) & 1) tpucall = 1;
  if (cli$present(c$dsc("EDITOR")) & 1) tpucall = 1;
/* JLH Stop READ EDITOR working within /CAPTIVE */
  if (news_captive) tpucall = 0;
  else if (cli$present(c$dsc("ROT13")) & 1) rot13 = 1;
  if ((news_context > 1) && curr_g && (curr_i > 0))
    return(do_readancestor(h,rot13,tpucall),0);
  else err_line("TOPIC: No newsgroup open");
***************
  if (cli$present(c$dsc("HEADER")) & 1) h = 1;
  if (cli$present(c$dsc("TPU")) & 1) tpucall = 1;
  if (cli$present(c$dsc("EDITOR")) & 1) tpucall = 1;
/* JLH Stop READ EDITOR working within /CAPTIVE */
  if (news_captive) tpucall = 0;
  else if (cli$present(c$dsc("ROT13")) & 1) rot13 = 1;
  unupd = item_update(curr_g,curr_i);
  if (!do_display(h,tpucall,rot13) && unupd) unupdate(curr_g,curr_i);
  return(0);
 
******************************
$1$DUA6:[NEWSMGR.NEWS.NEWS_SRC]NEWSSEARCH.C;49
 
  ldheader = 1;
  if (cli$present(c$dsc("TPU")) & 1) ldtpu = 1;
  if (cli$present(c$dsc("EDIT")) & 1) ldtpu = 1;
/* Next line stops SEARCH/EDIT command working for NEWS/CAPTIVE */
  if (news_captive) ldtpu = 0;
  if ((i = cli$present(c$dsc("DISPLAY"))) == CLI$_NEGATED) {
    i = 1;
    display_call = 0;
    }
 
******************************
$1$DUA6:[NEWSMGR.NEWS.NEWS_SRC]NEWSVARIABLES.H;80
 
      nntp_client iev(0),       /* this is a remote reader executable */
      nntp_proto iev(0),        /* this is a remote reader executable */
      news_readonly iev(0),
      news_captive iev(0),      /* JLH this is for captive NEWS reader accounts
*/
      parse_level iev(0),       /* current parse position */
      profile_scansize iev(-1),         /* first screen display size */
      nntp_no_posting_allowed iev(0),   /* set on a 201 server opening response
*/
      nntp_anu_news_server iev(0),      /* set on an ANU NEW implementation of t
he remote server */
 
 
--
-------------------------------------------------------------------------------
Jason L. Haar, Network Consultant, CSC, University of Canterbury, New Zealand.
Internet: j.haar@csc.canterbury.ac.nz  Phone: (64)(3) 642-336
-------------------------------------------------------------------------------
