X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ian/git?p=userv.git;a=blobdiff_plain;f=client.c;h=243a333c5fe29af9a7e9528e813dce02fd68c070;hp=4fbb710856cfeec82aff689388a35cb2ff493e1c;hb=7bc3c582a0a80d34d2c9c86ed9a588b3983e0db1;hpb=1982e587ecd564773110ad1099eabf5b12cb2a57 diff --git a/client.c b/client.c index 4fbb710..243a333 100644 --- a/client.c +++ b/client.c @@ -72,6 +72,7 @@ #include "config.h" #include "common.h" +#include "both.h" #include "version.h" enum fdmodifiervalues { @@ -213,7 +214,7 @@ static void NONRETURNPRINTFFORMAT(1,2) protoerror(const char *fmt, ...) { static void xfread(void *p, size_t sz, FILE *file) { size_t nr; - nr= fread(p,1,sz,file); + nr= working_fread(p,sz,file); if (nr != sz) protoreaderror(file,"in data"); } @@ -277,7 +278,8 @@ static void getprogress(struct progress_msg *progress_r, FILE *file) { protoerror("stderr message length %d is far too long", progress_r->data.errmsg.messagelen); for (i=0; idata.errmsg.messagelen; i++) { - c= getc(file); if (c==EOF) protoreaderror(file,"in error message"); + c= working_getc(file); + if (c==EOF) protoreaderror(file,"in error message"); if (isprint(c)) putc(c,stderr); else fprintf(stderr,"\\x%02x",(unsigned char)c); } @@ -378,6 +380,7 @@ static void sighandler_chld(int ignored) /* DOES return, unlike in daemon */ { memset(&event_mbuf,0,sizeof(event_mbuf)); event_mbuf.magic= EVENT_MAGIC; event_mbuf.type= et_closereadfd; + event_mbuf.data.closereadfd.fd= fd; r= fwrite(&event_mbuf,1,sizeof(event_mbuf),swfile); if (r != sizeof(event_mbuf) || fflush(swfile)) if (errno != EPIPE) syscallerror("inform service of closed read fd"); @@ -434,7 +437,7 @@ static void usage(void) { " --spoof-user } or same user\n" "fdmodifiers: read write overwrite trunc[ate]\n" "(separate with commas) append sync excl[usive] creat[e] fd\n\n" - "userv and uservd version " VERSION "; copyright (C)1996-1997 Ian Jackson.\n" + "userv and uservd version " VERSION VEREXT "; copyright (C)1996-1997 Ian Jackson.\n" "there is NO WARRANTY; type `userv --copyright' for details.\n", stderr) < 0) syscallerror("write usage to stderr"); @@ -737,13 +740,14 @@ static void callvalueoption(const struct optioninfo *oip, char *arg) { char *equals; if (oip->values == 2) { equals= strchr(arg,'='); - if (!equals) + if (!equals) { if (oip->abbrev) usageerror("option --%s (-%c) passed argument `%s' with no `='", oip->full,oip->abbrev,arg); else usageerror("option --%s passed argument `%s' with no `='", oip->full,arg); + } *equals++= 0; (oip->fn)(oip,equals,arg); } else { @@ -1047,6 +1051,7 @@ static void server_sendrequest(int argc, char *const *argv) { request_mbuf.serviceuserlen= strlen(serviceuser); request_mbuf.servicelen= strlen(argv[0]); request_mbuf.lognamelen= strlen(logname); + request_mbuf.spoofed= spoofuser ? 1 : 0; request_mbuf.cwdlen= cwdbufsize; request_mbuf.callinguid= spoofuid; request_mbuf.ngids= ngids+1; @@ -1127,6 +1132,7 @@ static void connect_pipes(void) { struct sigaction sig; char catnamebuf[sizeof(int)*3+30]; int fd, reading; + pid_t child; for (fd=0; fd