Open kuldeepdhaka opened 5 years ago
As per https://mosquitto.org/man/mosquitto-conf-5.html "If password_file, or acl_file are used in the config file alongsize auth_plugin, the plugin checks will run after the build in checks."
https://github.com/eclipse/mosquitto/blob/2d360fd49521ef8c1694288023f93cc605697189/src/security_default.c#L833-L886
In above code, if no user is found (having a hash table), mosquitto_unpwd_check_default() return MOSQ_ERR_AUTH (the last line of function)
mosquitto_unpwd_check_default()
MOSQ_ERR_AUTH
shouldn't it actually return MOSQ_ERR_PLUGIN_DEFER (at last line) since it suppose to defer it to other as per the docs)?
MOSQ_ERR_PLUGIN_DEFER
mosquitto_auth_unpwd_check() will never receive the callback if password_file is used in mosquitto.conf
mosquitto_auth_unpwd_check()
password_file
mosquitto.conf
Note: im very new to the code and based on heuristic this fixes my auth plugin not getting any callback.
diff --git a/src/security_default.c b/src/security_default.c index 99b7809..8f896b0 100644 --- a/src/security_default.c +++ b/src/security_default.c @@ -882,7 +882,7 @@ int mosquitto_unpwd_check_default(struct mosquitto_db *db, struct mosquitto *con } } - return MOSQ_ERR_AUTH; + return MOSQ_ERR_PLUGIN_DEFER; } static int unpwd__cleanup(struct mosquitto__unpwd **root, bool reload)
You're right (as in the PR), but it does need more work to fix properly and won't be in 1.6.
As per https://mosquitto.org/man/mosquitto-conf-5.html "If password_file, or acl_file are used in the config file alongsize auth_plugin, the plugin checks will run after the build in checks."
https://github.com/eclipse/mosquitto/blob/2d360fd49521ef8c1694288023f93cc605697189/src/security_default.c#L833-L886
In above code, if no user is found (having a hash table),
mosquitto_unpwd_check_default()
returnMOSQ_ERR_AUTH
(the last line of function)shouldn't it actually return
MOSQ_ERR_PLUGIN_DEFER
(at last line) since it suppose to defer it to other as per the docs)?mosquitto_auth_unpwd_check()
will never receive the callback ifpassword_file
is used inmosquitto.conf
Note: im very new to the code and based on heuristic this fixes my auth plugin not getting any callback.