Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 20 Apr 2016 23:56:44 +0000
From:      Phabricator <phabric-noreply@FreeBSD.org>
To:        freebsd-net@freebsd.org
Subject:   [Differential] D5853: dhclient: Log a warning instead of bailing upon "illegal" options
Message-ID:  <f8e61a04e9e2478512267ca6bdd03acf@localhost.localdomain>
In-Reply-To: <differential-rev-PHID-DREV-vd6opqd2lqtrmy6ddoga-req@FreeBSD.org>
References:  <differential-rev-PHID-DREV-vd6opqd2lqtrmy6ddoga-req@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help

[-- Attachment #1 --]
This revision was automatically updated to reflect the committed changes.
Closed by commit rS298385: dhclient: Log a warning instead of bailing upon "illegal" options (authored by sephe).

CHANGED PRIOR TO COMMIT
  https://reviews.freebsd.org/D5853?vs=14915&id=15413#toc

REPOSITORY
  rS FreeBSD src repository

CHANGES SINCE LAST UPDATE
  https://reviews.freebsd.org/D5853?vs=14915&id=15413

REVISION DETAIL
  https://reviews.freebsd.org/D5853

AFFECTED FILES
  head/sbin/dhclient/dhclient.c

CHANGE DETAILS
  diff --git a/head/sbin/dhclient/dhclient.c b/head/sbin/dhclient/dhclient.c
  --- a/head/sbin/dhclient/dhclient.c
  +++ b/head/sbin/dhclient/dhclient.c
  @@ -2275,6 +2275,17 @@
   {
   	int i, j, namelen;
   
  +	/* No `` or $() command substitution allowed in environment values! */
  +	for (j=0; j < strlen(value); j++)
  +		switch (value[j]) {
  +		case '`':
  +		case '$':
  +			warning("illegal character (%c) in value '%s'",
  +			    value[j], value);
  +			/* Ignore this option */
  +			return;
  +		}
  +
   	namelen = strlen(name);
   
   	for (i = 0; client->scriptEnv[i]; i++)
  @@ -2311,16 +2322,6 @@
   	    strlen(value) + 1);
   	if (client->scriptEnv[i] == NULL)
   		error("script_set_env: no memory for variable assignment");
  -
  -	/* No `` or $() command substitution allowed in environment values! */
  -	for (j=0; j < strlen(value); j++)
  -		switch (value[j]) {
  -		case '`':
  -		case '$':
  -			error("illegal character (%c) in value '%s'", value[j],
  -			    value);
  -			/* not reached */
  -		}
   	snprintf(client->scriptEnv[i], strlen(prefix) + strlen(name) +
   	    1 + strlen(value) + 1, "%s%s=%s", prefix, name, value);
   }

EMAIL PREFERENCES
  https://reviews.freebsd.org/settings/panel/emailpreferences/

To: sepherosa_gmail.com, network, secteam, delphij, glebius, adrian, honzhan_microsoft.com, howard0su_gmail.com, decui_microsoft.com, freebsd-net-list, pkelsey, gnn, jhb
Cc: sbruno

[-- Attachment #2 --]
diff --git a/head/sbin/dhclient/dhclient.c b/head/sbin/dhclient/dhclient.c
--- a/head/sbin/dhclient/dhclient.c
+++ b/head/sbin/dhclient/dhclient.c
@@ -2275,6 +2275,17 @@
 {
 	int i, j, namelen;
 
+	/* No `` or $() command substitution allowed in environment values! */
+	for (j=0; j < strlen(value); j++)
+		switch (value[j]) {
+		case '`':
+		case '$':
+			warning("illegal character (%c) in value '%s'",
+			    value[j], value);
+			/* Ignore this option */
+			return;
+		}
+
 	namelen = strlen(name);
 
 	for (i = 0; client->scriptEnv[i]; i++)
@@ -2311,16 +2322,6 @@
 	    strlen(value) + 1);
 	if (client->scriptEnv[i] == NULL)
 		error("script_set_env: no memory for variable assignment");
-
-	/* No `` or $() command substitution allowed in environment values! */
-	for (j=0; j < strlen(value); j++)
-		switch (value[j]) {
-		case '`':
-		case '$':
-			error("illegal character (%c) in value '%s'", value[j],
-			    value);
-			/* not reached */
-		}
 	snprintf(client->scriptEnv[i], strlen(prefix) + strlen(name) +
 	    1 + strlen(value) + 1, "%s%s=%s", prefix, name, value);
 }


Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?f8e61a04e9e2478512267ca6bdd03acf>