[
https://issues.apache.org/jira/browse/DISPATCH-1434?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16942813#comment-16942813
]
ASF GitHub Bot commented on DISPATCH-1434:
------------------------------------------
kgiusti commented on 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]
> Add new attribute saslPasswordFile to the connector entity
> ----------------------------------------------------------
>
> Key: DISPATCH-1434
> URL: https://issues.apache.org/jira/browse/DISPATCH-1434
> Project: Qpid Dispatch
> Issue Type: Improvement
> Components: Container
> Affects Versions: 1.9.0
> Reporter: Ganesh Murthy
> Assignee: Ganesh Murthy
> Priority: Major
>
> Add a new attribute called saslPasswordFile to the connector entity. This
> will enable users to specify the saslPassword in a file instead of specifying
> it in the config file.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]