Module Name:    src
Committed By:   dholland
Date:           Tue May 24 06:59:53 UTC 2011

Modified Files:
        src/usr.sbin/ypbind: ypbind.c

Log Message:
The name field of a domain should be dom->dom_name, not dom->dom_domain.
(This and the previous patch make the code far more readable.)


To generate a diff of this commit:
cvs rdiff -u -r1.78 -r1.79 src/usr.sbin/ypbind/ypbind.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/usr.sbin/ypbind/ypbind.c
diff -u src/usr.sbin/ypbind/ypbind.c:1.78 src/usr.sbin/ypbind/ypbind.c:1.79
--- src/usr.sbin/ypbind/ypbind.c:1.78	Tue May 24 06:59:35 2011
+++ src/usr.sbin/ypbind/ypbind.c	Tue May 24 06:59:53 2011
@@ -1,4 +1,4 @@
-/*	$NetBSD: ypbind.c,v 1.78 2011/05/24 06:59:35 dholland Exp $	*/
+/*	$NetBSD: ypbind.c,v 1.79 2011/05/24 06:59:53 dholland Exp $	*/
 
 /*
  * Copyright (c) 1992, 1993 Theo de Raadt <[email protected]>
@@ -28,7 +28,7 @@
 
 #include <sys/cdefs.h>
 #ifndef LINT
-__RCSID("$NetBSD: ypbind.c,v 1.78 2011/05/24 06:59:35 dholland Exp $");
+__RCSID("$NetBSD: ypbind.c,v 1.79 2011/05/24 06:59:53 dholland Exp $");
 #endif
 
 #include <sys/types.h>
@@ -87,7 +87,7 @@
 struct domain {
 	struct domain *dom_next;
 
-	char dom_domain[YPMAXDOMAIN + 1];
+	char dom_name[YPMAXDOMAIN + 1];
 	struct sockaddr_in dom_server_addr;
 	int dom_socket;
 	CLIENT *dom_client;
@@ -226,7 +226,7 @@
 	}
 
 	(void)memset(dom, 0, sizeof *dom);
-	(void)strlcpy(dom->dom_domain, name, sizeof(dom->dom_domain));
+	(void)strlcpy(dom->dom_name, name, sizeof(dom->dom_name));
 	return dom;
 }
 
@@ -240,7 +240,7 @@
 	char path[MAXPATHLEN];
 
 	(void)snprintf(path, sizeof(path), "%s/%s.%ld", BINDINGDIR,
-	    dom->dom_domain, dom->dom_vers);
+	    dom->dom_name, dom->dom_vers);
 
 	fd = open_locked(path, O_CREAT|O_RDWR|O_TRUNC, 0644);
 	if (fd == -1) {
@@ -260,7 +260,7 @@
 	char path[MAXPATHLEN];
 
 	(void)snprintf(path, sizeof(path), "%s/%s.%ld",
-	    BINDINGDIR, dom->dom_domain, dom->dom_vers);
+	    BINDINGDIR, dom->dom_name, dom->dom_vers);
 	(void)unlink(path);
 }
 
@@ -337,7 +337,7 @@
 		return;
 
 	for (dom = domains; dom != NULL; dom = dom->dom_next)
-		if (!strcmp(dom->dom_domain, dom_name))
+		if (!strcmp(dom->dom_name, dom_name))
 			break;
 
 	if (dom == NULL) {
@@ -436,7 +436,7 @@
 	    dom = dom->dom_next, count++) {
 		if (count > 100)
 			return NULL;		/* prevent denial of service */
-		if (!strcmp(dom->dom_domain, arg))
+		if (!strcmp(dom->dom_name, arg))
 			break;
 	}
 
@@ -481,7 +481,7 @@
 		dom->dom_server_addr.sin_addr.s_addr;
 	res.ypbind_respbody.ypbind_bindinfo.ypbind_binding_port =
 		dom->dom_server_addr.sin_port;
-	DPRINTF("domain %s at %s/%d\n", dom->dom_domain,
+	DPRINTF("domain %s at %s/%d\n", dom->dom_name,
 		inet_ntoa(dom->dom_server_addr.sin_addr),
 		ntohs(dom->dom_server_addr.sin_port));
 	return &res;
@@ -794,7 +794,7 @@
 	 * bind again.
 	 */
 	(void)snprintf(path, sizeof(path), "%s/%s.%ld", BINDINGDIR,
-	    dom->dom_domain, dom->dom_vers);
+	    dom->dom_name, dom->dom_vers);
 
 	fd = open_locked(path, O_RDONLY, 0644);
 	if (fd == -1) {
@@ -877,7 +877,7 @@
 			raddr.sin_port = htons((uint16_t)rmtcr_port);
 			dom = domain_find(msg.rm_xid);
 			if (dom != NULL)
-				rpc_received(dom->dom_domain, &raddr, 0);
+				rpc_received(dom->dom_name, &raddr, 0);
 		}
 	}
 	xdr.x_op = XDR_FREE;
@@ -931,7 +931,7 @@
 		    (msg.acpted_rply.ar_stat == SUCCESS)) {
 			dom = domain_find(msg.rm_xid);
 			if (dom != NULL)
-				rpc_received(dom->dom_domain, &raddr, 0);
+				rpc_received(dom->dom_name, &raddr, 0);
 		}
 	}
 	xdr.x_op = XDR_FREE;
@@ -944,7 +944,7 @@
 static int
 nag_servers(struct domain *dom)
 {
-	char *dom_name = dom->dom_domain;
+	char *dom_name = dom->dom_name;
 	struct rpc_msg msg;
 	char buf[BUFSIZE];
 	enum clnt_stat st;
@@ -1040,7 +1040,7 @@
 static int
 ping(struct domain *dom)
 {
-	char *dom_name = dom->dom_domain;
+	char *dom_name = dom->dom_name;
 	struct rpc_msg msg;
 	char buf[BUFSIZE];
 	enum clnt_stat st;

Reply via email to