Github user dskarbek commented on a diff in the pull request:

    https://github.com/apache/qpid-dispatch/pull/124#discussion_r91815078
  
    --- 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);
    +        }
    +        return pw;
    +    }
    +
    +    /* if the "password" starts with "literal:" or "literal: " then
    +     * the remaining text is the password and the heading should be
    +     * stripped off
    +     */
    +    if (strncmp(pw, "literal:", 8) == 0) {
    +        /* skip the "literal:" header */
    +        pw += 8;
    +        /* skip the space if it is there */
    +        if (*pw == ' ') ++pw;
    +        /* return a pointer into the middle of the string where the 
literal password starts */
    +        return pw;
    --- End diff --
    
    Not a problem unless I'm wrong about the memory management of this pointer.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org
For additional commands, e-mail: dev-h...@qpid.apache.org

Reply via email to