Annotation of 43BSD/contrib/news/uucp/=batch, revision 1.1.1.1

1.1       root        1: *** chkpth.c   Sun May 27 20:55:39 1979
                      2: --- chkpth.c.new       Sat Apr  2 21:34:39 1983
                      3: ***************
                      4: *** 40,45
                      5:        char c;
                      6:        int ret, i;
                      7:   
                      8:        if (Uptfirst) {
                      9:                ret = rdpth(Upt);
                     10:                ASSERT(ret == 0, "INIT USERFILE %d", Nbrusers);
                     11: 
                     12: --- 40,48 -----
                     13:        char c;
                     14:        int ret, i;
                     15:   
                     16: +      if (prefix("=/usr/lib/news/batch", path))
                     17: +              return(0);
                     18: + 
                     19:        if (Uptfirst) {
                     20:                ret = rdpth(Upt);
                     21:                ASSERT(ret == 0, "INIT USERFILE %d", Nbrusers);
                     22: *** cntrl.c    Sun May 27 20:56:46 1979
                     23: --- cntrl.c.new        Sat Apr  2 21:37:03 1983
                     24: ***************
                     25: *** 82,87
                     26:   char Wfile[MAXFULLNAME] = {'\0'};
                     27:   char Dfile[MAXFULLNAME];
                     28:   
                     29:   /*******
                     30:    *   cntrl(role, wkpre)
                     31:    *   int role;
                     32: 
                     33: --- 82,89 -----
                     34:   char Wfile[MAXFULLNAME] = {'\0'};
                     35:   char Dfile[MAXFULLNAME];
                     36:   
                     37: + FILE *pfopen();
                     38: + 
                     39:   /*******
                     40:    *   cntrl(role, wkpre)
                     41:    *   int role;
                     42: ***************
                     43: *** 164,170
                     44:                        if (index(W_OPTNS, 'c') == NULL)
                     45:                                fp = fopen(Dfile, "r");
                     46:                        if (fp == NULL &&
                     47: !                         (fp = fopen(filename, "r")) == NULL) {
                     48:                                /*  can not read data file  */
                     49:                                logent("CAN'T READ DATA", "FAILED");
                     50:                                unlinkdf(Dfile);
                     51: 
                     52: --- 166,172 -----
                     53:                        if (index(W_OPTNS, 'c') == NULL)
                     54:                                fp = fopen(Dfile, "r");
                     55:                        if (fp == NULL &&
                     56: !                         (fp = pfopen(filename, "r")) == NULL) {
                     57:                                /*  can not read data file  */
                     58:                                logent("CAN'T READ DATA", "FAILED");
                     59:                                unlinkdf(Dfile);
                     60: ***************
                     61: *** 282,288
                     62:                        notify(mailopt, W_USER, W_FILE1, Rmtname, &msg[1]);
                     63:                        ASSERT(role == MASTER,
                     64:                                "role - %d", role);
                     65: !                      fclose(fp);
                     66:                        unlinkdf(W_DFILE);
                     67:                        goto top;
                     68:                }
                     69: 
                     70: --- 284,290 -----
                     71:                        notify(mailopt, W_USER, W_FILE1, Rmtname, &msg[1]);
                     72:                        ASSERT(role == MASTER,
                     73:                                "role - %d", role);
                     74: !                      pfclose(fp);
                     75:                        unlinkdf(W_DFILE);
                     76:                        goto top;
                     77:                }
                     78: ***************
                     79: *** 292,298
                     80:                        ASSERT(role == MASTER,
                     81:                                "role - %d", role);
                     82:                        ret = (*Wrdata)(fp, Ofn);
                     83: !                      fclose(fp);
                     84:                        if (ret != 0) {
                     85:                                (*Turnoff)();
                     86:                                return(FAIL);
                     87: 
                     88: --- 294,300 -----
                     89:                        ASSERT(role == MASTER,
                     90:                                "role - %d", role);
                     91:                        ret = (*Wrdata)(fp, Ofn);
                     92: !                      pfclose(fp);
                     93:                        if (ret != 0) {
                     94:                                (*Turnoff)();
                     95:                                return(FAIL);
                     96: *** expfile.c  Sun May 27 20:57:47 1979
                     97: --- expfile.c.new      Sat Apr  2 21:39:05 1983
                     98: ***************
                     99: *** 19,24
                    100:        int uid;
                    101:   
                    102:        switch(file[0]) {
                    103:        case '/':
                    104:                return;
                    105:        case '~':
                    106: 
                    107: --- 19,25 -----
                    108:        int uid;
                    109:   
                    110:        switch(file[0]) {
                    111: +      case '=':
                    112:        case '/':
                    113:                return;
                    114:        case '~':
                    115: *** uux.c      Wed Aug 19 16:56:29 1981
                    116: --- uux.c.new  Sat Apr  2 21:40:01 1983
                    117: ***************
                    118: *** 231,240
                    119:                        expfile(rest);
                    120:                        gename(DATAPRE, xsys, 'A', dfile);
                    121:                        DEBUG(4, "rest %s\n", rest);
                    122: !                      if ((chkpth(User, "", rest) || anyread(rest)) != 0) {
                    123: !                              fprintf(stderr, "permission denied %s\n", rest);
                    124: !                              cleanup(1);
                    125: !                      }
                    126:                        if (xcp(rest, dfile) != 0) {
                    127:                                fprintf(stderr, "can't copy %s to %s\n", rest, dfile);
                    128:                                cleanup(1);
                    129: 
                    130: --- 231,241 -----
                    131:                        expfile(rest);
                    132:                        gename(DATAPRE, xsys, 'A', dfile);
                    133:                        DEBUG(4, "rest %s\n", rest);
                    134: !                      if (rest[0] == '/')
                    135: !                              if ((chkpth(User, "", rest) || anyread(rest)) != 0) {
                    136: !                                      fprintf(stderr, "permission denied %s\n", rest);
                    137: !                                      cleanup(1);
                    138: !                              }
                    139:                        if (xcp(rest, dfile) != 0) {
                    140:                                fprintf(stderr, "can't copy %s to %s\n", rest, dfile);
                    141:                                cleanup(1);
                    142: ******************
                    143: pfopen.c:
                    144: ------------------
                    145: /*
                    146:  * Routine like fopen, but checks for processes to open.
                    147:  * The process name begins with =, and any underscores
                    148:  * are translated into blanks.  We don't do things in the
                    149:  * obvious way (start with | or !, use blanks as themselves)
                    150:  * because getargs can't parse strings containing blanks in
                    151:  * all versions of uucp.
                    152:  */
                    153: 
                    154: #include <stdio.h>
                    155: 
                    156: static FILE *prevval = NULL;
                    157: 
                    158: FILE *popen();
                    159: 
                    160: FILE *
                    161: pfopen(name, mode)
                    162: char *name, *mode;
                    163: {
                    164:        char cmdbuf[256];
                    165:        register char *p;
                    166: 
                    167:        if (*name != '=') {
                    168:                prevval = NULL;
                    169:                return fopen(name, mode);
                    170:        }
                    171: 
                    172:        strcpy(cmdbuf, name);
                    173:        for (p=cmdbuf; *p; p++)
                    174:                if (*p == '_')
                    175:                        *p = ' ';
                    176:        p = cmdbuf+1;
                    177:        prevval = popen(p, mode);
                    178:        return prevval;
                    179: }
                    180: 
                    181: pfclose(fd)
                    182: FILE *fd;
                    183: {
                    184:        if (fd == prevval) {
                    185:                pclose(fd);
                    186:                prevval = NULL;
                    187:        } else
                    188:                fclose(fd);
                    189: }
                    190: ****************
                    191: 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.