[openssh-commits] [openssh] 06/06: upstream commit

git+noreply at mindrot.org git+noreply at mindrot.org
Fri Nov 3 16:20:52 AEDT 2017


This is an automated email from the git hooks/post-receive script.

djm pushed a commit to branch master
in repository openssh.

commit 33edb6ebdc2f81ebed1bceadacdfb8910b64fb88
Author: djm at openbsd.org@openbsd.org <djm at openbsd.org@openbsd.org>
Date:   Fri Nov 3 05:18:44 2017 +0000

    upstream commit
    
    reuse parse_multistate for parse_flag (yes/no arguments).
    Saves a few lines of code and makes the parser more consistent wrt case-
    sensitivity.  bz#2664 ok dtucker@
    
    OpenBSD-Commit-ID: b2ad1b6086858d5db71c7b11e5a74dba6d60efef
---
 servconf.c | 24 ++++++++----------------
 1 file changed, 8 insertions(+), 16 deletions(-)

diff --git a/servconf.c b/servconf.c
index 44de3536..ccb25784 100644
--- a/servconf.c
+++ b/servconf.c
@@ -1,5 +1,5 @@
 
-/* $OpenBSD: servconf.c,v 1.319 2017/11/03 03:18:53 dtucker Exp $ */
+/* $OpenBSD: servconf.c,v 1.320 2017/11/03 05:18:44 djm Exp $ */
 /*
  * Copyright (c) 1995 Tatu Ylonen <ylo at cs.hut.fi>, Espoo, Finland
  *                    All rights reserved
@@ -1098,6 +1098,11 @@ struct multistate {
 	char *key;
 	int value;
 };
+static const struct multistate multistate_flag[] = {
+	{ "yes",			1 },
+	{ "no",				0 },
+	{ NULL, -1 }
+};
 static const struct multistate multistate_addressfamily[] = {
 	{ "inet",			AF_INET },
 	{ "inet6",			AF_INET6 },
@@ -1338,21 +1343,8 @@ process_server_config_line(ServerOptions *options, char *line,
 	case sIgnoreRhosts:
 		intptr = &options->ignore_rhosts;
  parse_flag:
-		arg = strdelim(&cp);
-		if (!arg || *arg == '\0')
-			fatal("%s line %d: missing yes/no argument.",
-			    filename, linenum);
-		value = 0;	/* silence compiler */
-		if (strcmp(arg, "yes") == 0)
-			value = 1;
-		else if (strcmp(arg, "no") == 0)
-			value = 0;
-		else
-			fatal("%s line %d: Bad yes/no argument: %s",
-				filename, linenum, arg);
-		if (*activep && *intptr == -1)
-			*intptr = value;
-		break;
+		multistate_ptr = multistate_flag;
+		goto parse_multistate;
 
 	case sIgnoreUserKnownHosts:
 		intptr = &options->ignore_user_known_hosts;

-- 
To stop receiving notification emails like this one, please contact
djm at mindrot.org.


More information about the openssh-commits mailing list