Skip to content

Commit

Permalink
Fix use_identity_as_username true not working.
Browse files Browse the repository at this point in the history
Closes #833.

Thanks to David Crook and Brice Waegeneire.

Bug: #833

Signed-off-by: Roger A. Light <[email protected]>
  • Loading branch information
ralight committed Aug 8, 2018
1 parent 2a3305a commit 0d25cb5
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
1 change: 1 addition & 0 deletions ChangeLog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ Broker:
#209.
- Fix bridge publishing failing when per_listener_settings was true. Closes
#860.
- Fix `use_identity_as_username true` not working. Closes #833.

Library:
- Fix some places where return codes were incorrect, including to the
Expand Down
5 changes: 5 additions & 0 deletions src/handle_connect.c
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,11 @@ int handle__connect(struct mosquitto_db *db, struct mosquitto *context)
goto handle_connect_error;
}
context->username = mosquitto__strdup((char *) ASN1_STRING_data(name_asn1));
if(!context->username){
send__connack(context, 0, CONNACK_REFUSED_SERVER_UNAVAILABLE);
rc = MOSQ_ERR_NOMEM;
goto handle_connect_error;
}
/* Make sure there isn't an embedded NUL character in the CN */
if ((size_t)ASN1_STRING_length(name_asn1) != strlen(context->username)) {
send__connack(context, 0, CONNACK_REFUSED_BAD_USERNAME_PASSWORD);
Expand Down

0 comments on commit 0d25cb5

Please sign in to comment.