Github user dskarbek commented on a diff in the pull request:
https://github.com/apache/qpid-dispatch/pull/124#discussion_r91815006
--- Diff: src/connection_manager.c ---
@@ -176,6 +176,46 @@ static void set_config_host(qd_server_config_t
*config, qd_entity_t* entity)
assert(config->host);
}
+static char* qd_config_ssl_profile_get_password(qd_config_ssl_profile_t*
ssl_profile)
+{
+ char *pw = ssl_profile->ssl_password;
+ if (!pw) return pw;
+
+ /* if the "password" starts with "env:" or "env: " then the remaining
+ * text is the environment variable that contains the password
+ */
+ if (strncmp(pw, "env:", 4) == 0) {
+ char *env = pw + 4;
+ /* skip the space if it is there */
+ if (*env == ' ') ++env;
+
+ const char* passwd = getenv(env);
+ if (passwd) {
+ free(ssl_profile->ssl_password);
+ pw = ssl_profile->ssl_password = strdup(passwd);
+ } else {
+ qd_error(QD_ERROR_NOT_FOUND, "Failed to find a password in the
environment variable '%s'", env);
--- End diff --
or, would you rather just return the password string as is and not register
an error in-case it is an actual password? If it is referring to an env var
that missed getting set there's next to zero chance it will work, so better to
catch the error sooner at the source so we can log it appropriately, but this
does mean that someone using "env:foobar" as a password will suddenly stop
working.
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]