Use hash_find rather than hash_iter for unpwd check.
This commit is contained in:
parent
b66ffb8039
commit
18e79eac22
@ -888,7 +888,7 @@ static int mosquitto__memcmp_const(const void *a, const void *b, size_t len)
|
|||||||
|
|
||||||
int mosquitto_unpwd_check_default(struct mosquitto_db *db, struct mosquitto *context)
|
int mosquitto_unpwd_check_default(struct mosquitto_db *db, struct mosquitto *context)
|
||||||
{
|
{
|
||||||
struct mosquitto__unpwd *u, *tmp;
|
struct mosquitto__unpwd *u;
|
||||||
struct mosquitto__unpwd *unpwd_ref;
|
struct mosquitto__unpwd *unpwd_ref;
|
||||||
#ifdef WITH_TLS
|
#ifdef WITH_TLS
|
||||||
unsigned char hash[EVP_MAX_MD_SIZE];
|
unsigned char hash[EVP_MAX_MD_SIZE];
|
||||||
@ -921,8 +921,8 @@ int mosquitto_unpwd_check_default(struct mosquitto_db *db, struct mosquitto *con
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
HASH_ITER(hh, unpwd_ref, u, tmp){
|
HASH_FIND(hh, unpwd_ref, context->username, strlen(context->username), u);
|
||||||
if(!strcmp(u->username, context->username)){
|
if(u){
|
||||||
if(u->password){
|
if(u->password){
|
||||||
if(context->password){
|
if(context->password){
|
||||||
#ifdef WITH_TLS
|
#ifdef WITH_TLS
|
||||||
@ -948,7 +948,6 @@ int mosquitto_unpwd_check_default(struct mosquitto_db *db, struct mosquitto *con
|
|||||||
return MOSQ_ERR_SUCCESS;
|
return MOSQ_ERR_SUCCESS;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return MOSQ_ERR_AUTH;
|
return MOSQ_ERR_AUTH;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user