File:  [CSRG BSD Unix] / 43BSD / contrib / news / uucp / =batch
Revision 1.1.1.1 (vendor branch): download - view: text, annotated - select for diffs
Tue Apr 24 16:12:54 2018 UTC (8 years, 1 month ago) by root
Branches: MAIN, BSD
CVS tags: HEAD, BSD43
BSD 4.3

*** chkpth.c	Sun May 27 20:55:39 1979
--- chkpth.c.new	Sat Apr  2 21:34:39 1983
***************
*** 40,45
  	char c;
  	int ret, i;
  
  	if (Uptfirst) {
  		ret = rdpth(Upt);
  		ASSERT(ret == 0, "INIT USERFILE %d", Nbrusers);

--- 40,48 -----
  	char c;
  	int ret, i;
  
+ 	if (prefix("=/usr/lib/news/batch", path))
+ 		return(0);
+ 
  	if (Uptfirst) {
  		ret = rdpth(Upt);
  		ASSERT(ret == 0, "INIT USERFILE %d", Nbrusers);
*** cntrl.c	Sun May 27 20:56:46 1979
--- cntrl.c.new	Sat Apr  2 21:37:03 1983
***************
*** 82,87
  char Wfile[MAXFULLNAME] = {'\0'};
  char Dfile[MAXFULLNAME];
  
  /*******
   *	cntrl(role, wkpre)
   *	int role;

--- 82,89 -----
  char Wfile[MAXFULLNAME] = {'\0'};
  char Dfile[MAXFULLNAME];
  
+ FILE *pfopen();
+ 
  /*******
   *	cntrl(role, wkpre)
   *	int role;
***************
*** 164,170
  			if (index(W_OPTNS, 'c') == NULL)
  				fp = fopen(Dfile, "r");
  			if (fp == NULL &&
! 			   (fp = fopen(filename, "r")) == NULL) {
  				/*  can not read data file  */
  				logent("CAN'T READ DATA", "FAILED");
  				unlinkdf(Dfile);

--- 166,172 -----
  			if (index(W_OPTNS, 'c') == NULL)
  				fp = fopen(Dfile, "r");
  			if (fp == NULL &&
! 			   (fp = pfopen(filename, "r")) == NULL) {
  				/*  can not read data file  */
  				logent("CAN'T READ DATA", "FAILED");
  				unlinkdf(Dfile);
***************
*** 282,288
  			notify(mailopt, W_USER, W_FILE1, Rmtname, &msg[1]);
  			ASSERT(role == MASTER,
  				"role - %d", role);
! 			fclose(fp);
  			unlinkdf(W_DFILE);
  			goto top;
  		}

--- 284,290 -----
  			notify(mailopt, W_USER, W_FILE1, Rmtname, &msg[1]);
  			ASSERT(role == MASTER,
  				"role - %d", role);
! 			pfclose(fp);
  			unlinkdf(W_DFILE);
  			goto top;
  		}
***************
*** 292,298
  			ASSERT(role == MASTER,
  				"role - %d", role);
  			ret = (*Wrdata)(fp, Ofn);
! 			fclose(fp);
  			if (ret != 0) {
  				(*Turnoff)();
  				return(FAIL);

--- 294,300 -----
  			ASSERT(role == MASTER,
  				"role - %d", role);
  			ret = (*Wrdata)(fp, Ofn);
! 			pfclose(fp);
  			if (ret != 0) {
  				(*Turnoff)();
  				return(FAIL);
*** expfile.c	Sun May 27 20:57:47 1979
--- expfile.c.new	Sat Apr  2 21:39:05 1983
***************
*** 19,24
  	int uid;
  
  	switch(file[0]) {
  	case '/':
  		return;
  	case '~':

--- 19,25 -----
  	int uid;
  
  	switch(file[0]) {
+ 	case '=':
  	case '/':
  		return;
  	case '~':
*** uux.c	Wed Aug 19 16:56:29 1981
--- uux.c.new	Sat Apr  2 21:40:01 1983
***************
*** 231,240
  			expfile(rest);
  			gename(DATAPRE, xsys, 'A', dfile);
  			DEBUG(4, "rest %s\n", rest);
! 			if ((chkpth(User, "", rest) || anyread(rest)) != 0) {
! 				fprintf(stderr, "permission denied %s\n", rest);
! 				cleanup(1);
! 			}
  			if (xcp(rest, dfile) != 0) {
  				fprintf(stderr, "can't copy %s to %s\n", rest, dfile);
  				cleanup(1);

--- 231,241 -----
  			expfile(rest);
  			gename(DATAPRE, xsys, 'A', dfile);
  			DEBUG(4, "rest %s\n", rest);
! 			if (rest[0] == '/')
! 				if ((chkpth(User, "", rest) || anyread(rest)) != 0) {
! 					fprintf(stderr, "permission denied %s\n", rest);
! 					cleanup(1);
! 				}
  			if (xcp(rest, dfile) != 0) {
  				fprintf(stderr, "can't copy %s to %s\n", rest, dfile);
  				cleanup(1);
******************
pfopen.c:
------------------
/*
 * Routine like fopen, but checks for processes to open.
 * The process name begins with =, and any underscores
 * are translated into blanks.  We don't do things in the
 * obvious way (start with | or !, use blanks as themselves)
 * because getargs can't parse strings containing blanks in
 * all versions of uucp.
 */

#include <stdio.h>

static FILE *prevval = NULL;

FILE *popen();

FILE *
pfopen(name, mode)
char *name, *mode;
{
	char cmdbuf[256];
	register char *p;

	if (*name != '=') {
		prevval = NULL;
		return fopen(name, mode);
	}

	strcpy(cmdbuf, name);
	for (p=cmdbuf; *p; p++)
		if (*p == '_')
			*p = ' ';
	p = cmdbuf+1;
	prevval = popen(p, mode);
	return prevval;
}

pfclose(fd)
FILE *fd;
{
	if (fd == prevval) {
		pclose(fd);
		prevval = NULL;
	} else
		fclose(fd);
}
****************
Also be sure to add pfopen.o to the list of .o files in the makefile.

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.