Blob
1 #include "common.h"2 #include "send.h"4 /*5 * Run a command to authorize or refuse entry. Return status 0 means6 * authorize, -1 means refuse.7 */8 void9 authorize(dest *dp)10 {11 process *pp;12 String *errstr;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 dp->status = d_noforward;18 return;19 }20 errstr = s_new();21 while(s_read_line(pp->std[2]->fp, errstr))22 ;23 if ((dp->pstat = proc_wait(pp)) != 0) {24 dp->repl2 = errstr;25 dp->status = d_noforward;26 } else27 s_free(errstr);28 proc_free(pp);29 }