kgiusti 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_r330550035
##########
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:
This chunk of code appears to be a cut'n'paste of the ssl password file
parsing.
Would it be possible to eliminate the redundancy an instead create a local
(static) function that does this then have both the sasl and ssl codepaths call
it?
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]