Wed May 25 04:59:22 2011 UTC ()
Don't print uninitialized values off the stack, even as debug messages.


(dholland)
diff -r1.87 -r1.88 src/usr.sbin/ypbind/ypbind.c

cvs diff -r1.87 -r1.88 src/usr.sbin/ypbind/ypbind.c (expand / switch to unified diff)

--- src/usr.sbin/ypbind/ypbind.c 2011/05/25 04:33:52 1.87
+++ src/usr.sbin/ypbind/ypbind.c 2011/05/25 04:59:22 1.88
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1/* $NetBSD: ypbind.c,v 1.87 2011/05/25 04:33:52 dholland Exp $ */ 1/* $NetBSD: ypbind.c,v 1.88 2011/05/25 04:59:22 dholland Exp $ */
2 2
3/* 3/*
4 * Copyright (c) 1992, 1993 Theo de Raadt <deraadt@fsa.ca> 4 * Copyright (c) 1992, 1993 Theo de Raadt <deraadt@fsa.ca>
5 * All rights reserved. 5 * All rights reserved.
6 * 6 *
7 * Redistribution and use in source and binary forms, with or without 7 * Redistribution and use in source and binary forms, with or without
8 * modification, are permitted provided that the following conditions 8 * modification, are permitted provided that the following conditions
9 * are met: 9 * are met:
10 * 1. Redistributions of source code must retain the above copyright 10 * 1. Redistributions of source code must retain the above copyright
11 * notice, this list of conditions and the following disclaimer. 11 * notice, this list of conditions and the following disclaimer.
12 * 2. Redistributions in binary form must reproduce the above copyright 12 * 2. Redistributions in binary form must reproduce the above copyright
13 * notice, this list of conditions and the following disclaimer in the 13 * notice, this list of conditions and the following disclaimer in the
14 * documentation and/or other materials provided with the distribution. 14 * documentation and/or other materials provided with the distribution.
@@ -18,27 +18,27 @@ @@ -18,27 +18,27 @@
18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 18 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 19 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY
20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 20 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS 21 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 22 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 23 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
26 * SUCH DAMAGE. 26 * SUCH DAMAGE.
27 */ 27 */
28 28
29#include <sys/cdefs.h> 29#include <sys/cdefs.h>
30#ifndef LINT 30#ifndef LINT
31__RCSID("$NetBSD: ypbind.c,v 1.87 2011/05/25 04:33:52 dholland Exp $"); 31__RCSID("$NetBSD: ypbind.c,v 1.88 2011/05/25 04:59:22 dholland Exp $");
32#endif 32#endif
33 33
34#include <sys/types.h> 34#include <sys/types.h>
35#include <sys/param.h> 35#include <sys/param.h>
36#include <sys/file.h> 36#include <sys/file.h>
37#include <sys/ioctl.h> 37#include <sys/ioctl.h>
38#include <sys/signal.h> 38#include <sys/signal.h>
39#include <sys/socket.h> 39#include <sys/socket.h>
40#include <sys/stat.h> 40#include <sys/stat.h>
41#include <sys/syslog.h> 41#include <sys/syslog.h>
42#include <sys/uio.h> 42#include <sys/uio.h>
43#include <arpa/inet.h> 43#include <arpa/inet.h>
44#include <net/if.h> 44#include <net/if.h>
@@ -511,29 +511,29 @@ ypbindproc_domain_2(SVCXPRT *transp, voi @@ -511,29 +511,29 @@ ypbindproc_domain_2(SVCXPRT *transp, voi
511 DPRINTF("domain %s at %s/%d\n", dom->dom_name, 511 DPRINTF("domain %s at %s/%d\n", dom->dom_name,
512 inet_ntoa(dom->dom_server_addr.sin_addr), 512 inet_ntoa(dom->dom_server_addr.sin_addr),
513 ntohs(dom->dom_server_addr.sin_port)); 513 ntohs(dom->dom_server_addr.sin_port));
514 return &res; 514 return &res;
515} 515}
516 516
517static void * 517static void *
518ypbindproc_setdom_2(SVCXPRT *transp, void *argp) 518ypbindproc_setdom_2(SVCXPRT *transp, void *argp)
519{ 519{
520 struct ypbind_setdom *sd = argp; 520 struct ypbind_setdom *sd = argp;
521 struct sockaddr_in *fromsin, bindsin; 521 struct sockaddr_in *fromsin, bindsin;
522 static bool_t res; 522 static bool_t res;
523 523
524 DPRINTF("ypbindproc_setdom_2 %s\n", inet_ntoa(bindsin.sin_addr)); 
525 (void)memset(&res, 0, sizeof(res)); 524 (void)memset(&res, 0, sizeof(res));
526 fromsin = svc_getcaller(transp); 525 fromsin = svc_getcaller(transp);
 526 DPRINTF("ypbindproc_setdom_2 from %s\n", inet_ntoa(fromsin->sin_addr));
527 527
528 if (allow_any_ypset) { 528 if (allow_any_ypset) {
529 /* nothing */ 529 /* nothing */
530 } else if (allow_local_ypset) { 530 } else if (allow_local_ypset) {
531 if (fromsin->sin_addr.s_addr != htonl(INADDR_LOOPBACK)) { 531 if (fromsin->sin_addr.s_addr != htonl(INADDR_LOOPBACK)) {
532 DPRINTF("ypset denied from %s\n", 532 DPRINTF("ypset denied from %s\n",
533 inet_ntoa(fromsin->sin_addr)); 533 inet_ntoa(fromsin->sin_addr));
534 return NULL; 534 return NULL;
535 } 535 }
536 } else { 536 } else {
537 DPRINTF("ypset denied\n"); 537 DPRINTF("ypset denied\n");
538 return NULL; 538 return NULL;
539 } 539 }