1 #include "common.h" 2 #include "send.h" 3 4 /* 5 * Run a command to authorize or refuse entry. Return status 0 means 6 * authorize, -1 means refuse. 7 */ 8 void 9 authorize(dest *dp) 10 { 11 process *pp; 12 String *errstr; 13 14 dp->authorized = 1; 15 pp = proc_start(s_to_c(dp->repl1), (stream *)0, (stream *)0, outstream(), 1, 0); 16 if (pp == 0) 17 return; 18 errstr = s_new(); 19 while(s_read_line(pp->std[2]->fp, errstr)) 20 ; 21 if ((dp->pstat = proc_wait(pp)) != 0) { 22 dp->repl2 = errstr; 23 dp->status = d_noforward; 24 } else 25 s_free(errstr); 26 proc_free(pp); 27 } 28