FreeBSD Bugzilla – Attachment 190037 Details for
Bug 225434
[patch] Treat set but empty environment variables as unset in /usr/libexec/phttpget
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
patch to treat set-to-empty environment variables as not-set
phttpget.c.diff (text/plain), 1.39 KB, created by
Vasil Dimov
on 2018-01-24 16:32:11 UTC
(
hide
)
Description:
patch to treat set-to-empty environment variables as not-set
Filename:
MIME Type:
Creator:
Vasil Dimov
Created:
2018-01-24 16:32:11 UTC
Size:
1.39 KB
patch
obsolete
>diff --git a/usr.sbin/portsnap/phttpget/phttpget.c b/usr.sbin/portsnap/phttpget/phttpget.c >index 33e969a63ed..aabf260eb78 100644 >--- a/usr.sbin/portsnap/phttpget/phttpget.c >+++ b/usr.sbin/portsnap/phttpget/phttpget.c >@@ -119,6 +119,12 @@ b64enc(const char *ptext) > return (ctext); > } > >+static inline int >+is_set(const char *s) >+{ >+ return s != NULL && s[0] != '\0'; >+} >+ > static void > readenv(void) > { >@@ -128,9 +134,9 @@ readenv(void) > long http_timeout; > > env_HTTP_PROXY = getenv("HTTP_PROXY"); >- if (env_HTTP_PROXY == NULL) >+ if (!is_set(env_HTTP_PROXY)) > env_HTTP_PROXY = getenv("http_proxy"); >- if (env_HTTP_PROXY != NULL) { >+ if (is_set(env_HTTP_PROXY)) { > if (strncmp(env_HTTP_PROXY, "http://", 7) == 0) > env_HTTP_PROXY += 7; > p = strchr(env_HTTP_PROXY, '/'); >@@ -145,8 +151,8 @@ readenv(void) > } > > env_HTTP_PROXY_AUTH = getenv("HTTP_PROXY_AUTH"); >- if ((env_HTTP_PROXY != NULL) && >- (env_HTTP_PROXY_AUTH != NULL) && >+ if (is_set(env_HTTP_PROXY) && >+ is_set(env_HTTP_PROXY_AUTH) && > (strncasecmp(env_HTTP_PROXY_AUTH, "basic:" , 6) == 0)) { > /* Ignore authentication scheme */ > (void) strsep(&env_HTTP_PROXY_AUTH, ":"); >@@ -180,7 +186,7 @@ readenv(void) > proxyauth = NULL; > > env_HTTP_USER_AGENT = getenv("HTTP_USER_AGENT"); >- if (env_HTTP_USER_AGENT == NULL) >+ if (!is_set(env_HTTP_USER_AGENT)) > env_HTTP_USER_AGENT = "phttpget/0.1"; > > env_HTTP_TIMEOUT = getenv("HTTP_TIMEOUT");
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 225434
: 190037