You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@qpid.apache.org by GitBox <gi...@apache.org> on 2019/10/02 14:26:00 UTC

[GitHub] [qpid-dispatch] ganeshmurthy commented on a change in pull request #578: DISPATCH-1434 - Added new attribute saslPasswordFile to the connector…

ganeshmurthy commented on a change in pull request #578: DISPATCH-1434 - Added new attribute saslPasswordFile to the connector…
URL: https://github.com/apache/qpid-dispatch/pull/578#discussion_r330580810
 
 

 ##########
 File path: src/connection_manager.c
 ##########
 @@ -327,6 +329,41 @@ static qd_error_t load_server_config(qd_dispatch_t *qd, qd_server_config_t *conf
     }
     config->sasl_username        = qd_entity_opt_string(entity, "saslUsername", 0);   CHECK();
     config->sasl_password        = qd_entity_opt_string(entity, "saslPassword", 0);   CHECK();
+
+    if (config->sasl_password) {
+        qd_log(cm->log_source, QD_LOG_WARNING, "Attribute saslPassword of entity connector has been deprecated. Use saslPasswordFile instead.");
+    }
+    else {
+        // saslPassword not provided. Check if saslPasswordFile property is specified.
+        char *password_file = qd_entity_opt_string(entity, "saslPasswordFile", 0); CHECK();
+
+        if (password_file) {
+            FILE *file = fopen(password_file, "r");
+
+            if (file) {
+                char buffer[200];
+
+                int c;
+                int i=0;
+
+                while (i < 200 - 1) {
+                    c = fgetc(file);
+                    if (c == EOF || c == '\n')
+                        break;
+                    buffer[i++] = c;
+                }
+
+                if (i != 0) {
+                    buffer[i] = '\0';
+                    free(config->sasl_password);
+                    config->sasl_password = strdup(buffer);
+                }
+                fclose(file);
+            }
+        }
+        free(password_file);
+    }
+
 
 Review comment:
   Done

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

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