diff options
| author | rsc <devnull@localhost> | 2005-10-29 16:26:44 +0000 |
|---|---|---|
| committer | rsc <devnull@localhost> | 2005-10-29 16:26:44 +0000 |
| commit | 5cdb17983ae6e6367ad7a940cb219eab247a9304 (patch) | |
| tree | 8ca1ef49af2a96e7daebe624d91fdf679814a057 /src/cmd/upas/send/authorize.c | |
| parent | cd3745196389579fb78b9b01ef1daefb5a57aa71 (diff) | |
| download | plan9port-5cdb17983ae6e6367ad7a940cb219eab247a9304.tar.gz plan9port-5cdb17983ae6e6367ad7a940cb219eab247a9304.zip | |
Thanks to John Cummings.
Diffstat (limited to 'src/cmd/upas/send/authorize.c')
| -rw-r--r-- | src/cmd/upas/send/authorize.c | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/src/cmd/upas/send/authorize.c b/src/cmd/upas/send/authorize.c new file mode 100644 index 00000000..6fa12c57 --- /dev/null +++ b/src/cmd/upas/send/authorize.c @@ -0,0 +1,29 @@ +#include "common.h" +#include "send.h" + +/* + * Run a command to authorize or refuse entry. Return status 0 means + * authorize, -1 means refuse. + */ +void +authorize(dest *dp) +{ + process *pp; + String *errstr; + + dp->authorized = 1; + pp = proc_start(s_to_c(dp->repl1), (stream *)0, (stream *)0, outstream(), 1, 0); + if (pp == 0){ + dp->status = d_noforward; + return; + } + errstr = s_new(); + while(s_read_line(pp->std[2]->fp, errstr)) + ; + if ((dp->pstat = proc_wait(pp)) != 0) { + dp->repl2 = errstr; + dp->status = d_noforward; + } else + s_free(errstr); + proc_free(pp); +} |
