summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTheo de Raadt <deraadt@cvs.openbsd.org>2015-09-01 19:54:02 +0000
committerTheo de Raadt <deraadt@cvs.openbsd.org>2015-09-01 19:54:02 +0000
commitc1c64599aeaf94710989d5d76f665a48e34b5eee (patch)
tree34a101a50b8f8f873633df15e5c9340d0876792b
parent6518bfc2799a968dce85f0c7b71dbf02b10dbc91 (diff)
Remove all bogus writes to stderr. Only explicit requests should
go that way. ok miod beck
-rw-r--r--lib/libc/rpc/auth_unix.c11
-rw-r--r--lib/libc/rpc/clnt_tcp.c4
-rw-r--r--lib/libc/rpc/clnt_udp.c4
-rw-r--r--lib/libc/rpc/svc_simple.c31
-rw-r--r--lib/libc/rpc/svc_tcp.c9
-rw-r--r--lib/libc/rpc/svc_udp.c5
-rw-r--r--lib/libc/rpc/xdr.c10
-rw-r--r--lib/libc/rpc/xdr_array.c7
-rw-r--r--lib/libc/rpc/xdr_rec.c5
-rw-r--r--lib/libc/rpc/xdr_reference.c7
10 files changed, 23 insertions, 70 deletions
diff --git a/lib/libc/rpc/auth_unix.c b/lib/libc/rpc/auth_unix.c
index 099b977c0c4..6aaeceeb019 100644
--- a/lib/libc/rpc/auth_unix.c
+++ b/lib/libc/rpc/auth_unix.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: auth_unix.c,v 1.22 2010/09/01 14:43:34 millert Exp $ */
+/* $OpenBSD: auth_unix.c,v 1.23 2015/09/01 19:54:00 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -103,15 +103,12 @@ authunix_create(char *machname, int uid, int gid, int len, int *aup_gids)
*/
auth = (AUTH *)mem_alloc(sizeof(*auth));
#ifndef KERNEL
- if (auth == NULL) {
- (void)fprintf(stderr, "authunix_create: out of memory\n");
+ if (auth == NULL)
return (NULL);
- }
#endif
au = (struct audata *)mem_alloc(sizeof(*au));
#ifndef KERNEL
if (au == NULL) {
- (void)fprintf(stderr, "authunix_create: out of memory\n");
free(auth);
return (NULL);
}
@@ -143,10 +140,8 @@ authunix_create(char *machname, int uid, int gid, int len, int *aup_gids)
#ifdef KERNEL
au->au_origcred.oa_base = mem_alloc((u_int) len);
#else
- if ((au->au_origcred.oa_base = mem_alloc((u_int) len)) == NULL) {
- (void)fprintf(stderr, "authunix_create: out of memory\n");
+ if ((au->au_origcred.oa_base = mem_alloc((u_int) len)) == NULL)
goto authfail;
- }
#endif
memcpy(au->au_origcred.oa_base, mymem, (u_int)len);
diff --git a/lib/libc/rpc/clnt_tcp.c b/lib/libc/rpc/clnt_tcp.c
index c40de1107a1..1b164d6b0a2 100644
--- a/lib/libc/rpc/clnt_tcp.c
+++ b/lib/libc/rpc/clnt_tcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clnt_tcp.c,v 1.26 2014/11/11 04:51:49 guenther Exp $ */
+/* $OpenBSD: clnt_tcp.c,v 1.27 2015/09/01 19:54:01 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -119,14 +119,12 @@ clnttcp_create(struct sockaddr_in *raddr, u_long prog, u_long vers, int *sockp,
h = (CLIENT *)mem_alloc(sizeof(*h));
if (h == NULL) {
- (void)fprintf(stderr, "clnttcp_create: out of memory\n");
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
rpc_createerr.cf_error.re_errno = errno;
goto fooy;
}
ct = (struct ct_data *)mem_alloc(sizeof(*ct));
if (ct == NULL) {
- (void)fprintf(stderr, "clnttcp_create: out of memory\n");
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
rpc_createerr.cf_error.re_errno = errno;
goto fooy;
diff --git a/lib/libc/rpc/clnt_udp.c b/lib/libc/rpc/clnt_udp.c
index af43cc082e2..7a30c38fc63 100644
--- a/lib/libc/rpc/clnt_udp.c
+++ b/lib/libc/rpc/clnt_udp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: clnt_udp.c,v 1.28 2015/05/17 01:15:44 deraadt Exp $ */
+/* $OpenBSD: clnt_udp.c,v 1.29 2015/09/01 19:54:01 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -114,7 +114,6 @@ clntudp_bufcreate(struct sockaddr_in *raddr, u_long program, u_long version,
cl = (CLIENT *)mem_alloc(sizeof(CLIENT));
if (cl == NULL) {
- (void) fprintf(stderr, "clntudp_create: out of memory\n");
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
rpc_createerr.cf_error.re_errno = errno;
goto fooy;
@@ -123,7 +122,6 @@ clntudp_bufcreate(struct sockaddr_in *raddr, u_long program, u_long version,
recvsz = ((recvsz + 3) / 4) * 4;
cu = (struct cu_data *)mem_alloc(sizeof(*cu) + sendsz + recvsz);
if (cu == NULL) {
- (void) fprintf(stderr, "clntudp_create: out of memory\n");
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
rpc_createerr.cf_error.re_errno = errno;
goto fooy;
diff --git a/lib/libc/rpc/svc_simple.c b/lib/libc/rpc/svc_simple.c
index 22bd5352b14..9675332cf20 100644
--- a/lib/libc/rpc/svc_simple.c
+++ b/lib/libc/rpc/svc_simple.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svc_simple.c,v 1.12 2015/08/20 21:49:29 deraadt Exp $ */
+/* $OpenBSD: svc_simple.c,v 1.13 2015/09/01 19:54:01 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -60,30 +60,20 @@ registerrpc(int prognum, int versnum, int procnum, char *(*progname)(),
{
struct proglst *pl;
- if (procnum == NULLPROC) {
- (void) fprintf(stderr,
- "can't reassign procedure number %u\n", NULLPROC);
+ if (procnum == NULLPROC)
return (-1);
- }
if (transp == NULL) {
transp = svcudp_create(RPC_ANYSOCK);
- if (transp == NULL) {
- (void) fprintf(stderr, "couldn't create an rpc server\n");
+ if (transp == NULL)
return (-1);
- }
}
(void) pmap_unset((u_long)prognum, (u_long)versnum);
if (!svc_register(transp, (u_long)prognum, (u_long)versnum,
- universal, IPPROTO_UDP)) {
- (void) fprintf(stderr, "couldn't register prog %d vers %d\n",
- prognum, versnum);
+ universal, IPPROTO_UDP))
return (-1);
- }
pl = malloc(sizeof(struct proglst));
- if (pl == NULL) {
- (void) fprintf(stderr, "registerrpc: out of memory\n");
+ if (pl == NULL)
return (-1);
- }
pl->p_progname = progname;
pl->p_prognum = prognum;
pl->p_procnum = procnum;
@@ -106,10 +96,8 @@ universal(struct svc_req *rqstp, SVCXPRT *transp)
* enforce "procnum 0 is echo" convention
*/
if (rqstp->rq_proc == NULLPROC) {
- if (svc_sendreply(transp, xdr_void, NULL) == FALSE) {
- (void) fprintf(stderr, "xxx\n");
+ if (svc_sendreply(transp, xdr_void, NULL) == FALSE)
exit(1);
- }
return;
}
prog = rqstp->rq_prog;
@@ -127,17 +115,12 @@ universal(struct svc_req *rqstp, SVCXPRT *transp)
pl->p_outproc != xdr_void)
/* there was an error */
return;
- if (!svc_sendreply(transp, pl->p_outproc, outdata)) {
- (void) fprintf(stderr,
- "trouble replying to prog %d\n",
- pl->p_prognum);
+ if (!svc_sendreply(transp, pl->p_outproc, outdata))
exit(1);
- }
/* free the decoded arguments */
(void)svc_freeargs(transp, pl->p_inproc, xdrbuf);
return;
}
- (void) fprintf(stderr, "never registered prog %d\n", prog);
exit(1);
}
diff --git a/lib/libc/rpc/svc_tcp.c b/lib/libc/rpc/svc_tcp.c
index f30911d23dc..d0ee4b019c1 100644
--- a/lib/libc/rpc/svc_tcp.c
+++ b/lib/libc/rpc/svc_tcp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svc_tcp.c,v 1.34 2015/09/01 17:31:39 deraadt Exp $ */
+/* $OpenBSD: svc_tcp.c,v 1.35 2015/09/01 19:54:01 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -153,7 +153,6 @@ svctcp_create(int sock, u_int sendsize, u_int recvsize)
}
r = (struct tcp_rendezvous *)mem_alloc(sizeof(*r));
if (r == NULL) {
- (void)fprintf(stderr, "svctcp_create: out of memory\n");
if (madesock)
(void)close(sock);
return (NULL);
@@ -162,7 +161,6 @@ svctcp_create(int sock, u_int sendsize, u_int recvsize)
r->recvsize = recvsize;
xprt = (SVCXPRT *)mem_alloc(sizeof(SVCXPRT));
if (xprt == NULL) {
- (void)fprintf(stderr, "svctcp_create: out of memory\n");
if (madesock)
(void)close(sock);
free(r);
@@ -202,13 +200,10 @@ makefd_xprt(int fd, u_int sendsize, u_int recvsize)
struct tcp_conn *cd;
xprt = (SVCXPRT *)mem_alloc(sizeof(SVCXPRT));
- if (xprt == NULL) {
- (void) fprintf(stderr, "svc_tcp: makefd_xprt: out of memory\n");
+ if (xprt == NULL)
goto done;
- }
cd = (struct tcp_conn *)mem_alloc(sizeof(struct tcp_conn));
if (cd == NULL) {
- (void) fprintf(stderr, "svc_tcp: makefd_xprt: out of memory\n");
mem_free((char *) xprt, sizeof(SVCXPRT));
xprt = NULL;
goto done;
diff --git a/lib/libc/rpc/svc_udp.c b/lib/libc/rpc/svc_udp.c
index 6a889e17d20..b494d92c057 100644
--- a/lib/libc/rpc/svc_udp.c
+++ b/lib/libc/rpc/svc_udp.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: svc_udp.c,v 1.22 2015/09/01 17:31:39 deraadt Exp $ */
+/* $OpenBSD: svc_udp.c,v 1.23 2015/09/01 19:54:01 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -122,14 +122,12 @@ svcudp_bufcreate(int sock, u_int sendsz, u_int recvsz)
}
xprt = malloc(sizeof(SVCXPRT));
if (xprt == NULL) {
- (void)fprintf(stderr, "svcudp_create: out of memory\n");
if (madesock)
(void)close(sock);
return (NULL);
}
su = malloc(sizeof(*su));
if (su == NULL) {
- (void)fprintf(stderr, "svcudp_create: out of memory\n");
if (madesock)
(void)close(sock);
free(xprt);
@@ -137,7 +135,6 @@ svcudp_bufcreate(int sock, u_int sendsz, u_int recvsz)
}
su->su_iosz = ((MAX(sendsz, recvsz) + 3) / 4) * 4;
if ((rpc_buffer(xprt) = malloc(su->su_iosz)) == NULL) {
- (void)fprintf(stderr, "svcudp_create: out of memory\n");
if (madesock)
(void)close(sock);
free(xprt);
diff --git a/lib/libc/rpc/xdr.c b/lib/libc/rpc/xdr.c
index b3a086d3e74..dfc7a554845 100644
--- a/lib/libc/rpc/xdr.c
+++ b/lib/libc/rpc/xdr.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xdr.c,v 1.12 2014/03/16 18:38:30 guenther Exp $ */
+/* $OpenBSD: xdr.c,v 1.13 2015/09/01 19:54:01 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -508,10 +508,8 @@ xdr_bytes(XDR *xdrs, char **cpp, u_int *sizep, u_int maxsize)
if (sp == NULL) {
*cpp = sp = (char *)mem_alloc(nodesize);
}
- if (sp == NULL) {
- (void) fprintf(stderr, "xdr_bytes: out of memory\n");
+ if (sp == NULL)
return (FALSE);
- }
/* fall into ... */
case XDR_ENCODE:
@@ -635,10 +633,8 @@ xdr_string(XDR *xdrs, char **cpp, u_int maxsize)
}
if (sp == NULL)
*cpp = sp = (char *)mem_alloc(nodesize);
- if (sp == NULL) {
- (void) fprintf(stderr, "xdr_string: out of memory\n");
+ if (sp == NULL)
return (FALSE);
- }
sp[size] = 0;
/* fall into ... */
diff --git a/lib/libc/rpc/xdr_array.c b/lib/libc/rpc/xdr_array.c
index 43e9ebea534..f24847e07d8 100644
--- a/lib/libc/rpc/xdr_array.c
+++ b/lib/libc/rpc/xdr_array.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xdr_array.c,v 1.10 2010/09/01 14:43:34 millert Exp $ */
+/* $OpenBSD: xdr_array.c,v 1.11 2015/09/01 19:54:01 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -86,11 +86,8 @@ xdr_array(XDR *xdrs,
if (c == 0)
return (TRUE);
*addrp = target = mem_alloc(nodesize);
- if (target == NULL) {
- (void) fprintf(stderr,
- "xdr_array: out of memory\n");
+ if (target == NULL)
return (FALSE);
- }
memset(target, 0, nodesize);
break;
case XDR_FREE:
diff --git a/lib/libc/rpc/xdr_rec.c b/lib/libc/rpc/xdr_rec.c
index e280c1d697c..76a38d42124 100644
--- a/lib/libc/rpc/xdr_rec.c
+++ b/lib/libc/rpc/xdr_rec.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xdr_rec.c,v 1.17 2013/11/26 20:33:08 deraadt Exp $ */
+/* $OpenBSD: xdr_rec.c,v 1.18 2015/09/01 19:54:01 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -159,7 +159,6 @@ xdrrec_create(XDR *xdrs, u_int sendsize, u_int recvsize, caddr_t tcp_handle,
(RECSTREAM *)mem_alloc(sizeof(RECSTREAM));
if (rstrm == NULL) {
- (void)fprintf(stderr, "xdrrec_create: out of memory\n");
/*
* This is bad. Should rework xdrrec_create to
* return a handle, and in this case return NULL
@@ -170,7 +169,6 @@ xdrrec_create(XDR *xdrs, u_int sendsize, u_int recvsize, caddr_t tcp_handle,
rstrm->sendsize = sendsize = fix_buf_size(sendsize);
rstrm->out_base = malloc(rstrm->sendsize);
if (rstrm->out_base == NULL) {
- (void)fprintf(stderr, "xdrrec_create: out of memory\n");
mem_free(rstrm, sizeof(RECSTREAM));
return;
}
@@ -178,7 +176,6 @@ xdrrec_create(XDR *xdrs, u_int sendsize, u_int recvsize, caddr_t tcp_handle,
rstrm->recvsize = recvsize = fix_buf_size(recvsize);
rstrm->in_base = malloc(recvsize);
if (rstrm->in_base == NULL) {
- (void)fprintf(stderr, "xdrrec_create: out of memory\n");
mem_free(rstrm->out_base, sendsize);
mem_free(rstrm, sizeof(RECSTREAM));
return;
diff --git a/lib/libc/rpc/xdr_reference.c b/lib/libc/rpc/xdr_reference.c
index ae49864e44b..a5f7594bbc9 100644
--- a/lib/libc/rpc/xdr_reference.c
+++ b/lib/libc/rpc/xdr_reference.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: xdr_reference.c,v 1.9 2010/09/01 14:43:34 millert Exp $ */
+/* $OpenBSD: xdr_reference.c,v 1.10 2015/09/01 19:54:01 deraadt Exp $ */
/*
* Copyright (c) 2010, Oracle America, Inc.
@@ -69,11 +69,8 @@ xdr_reference(XDR *xdrs,
case XDR_DECODE:
*pp = loc = (caddr_t) calloc(size, 1);
- if (loc == NULL) {
- (void) fprintf(stderr,
- "xdr_reference: out of memory\n");
+ if (loc == NULL)
return (FALSE);
- }
break;
}