From 5485ce1da03d58e849ba20851a2202243c92a0cc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ignacio=20G=C3=B3mez?= Date: Fri, 27 Sep 2019 10:38:04 -0300 Subject: [PATCH] Tidy up plugin checks. --- go-auth.go | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/go-auth.go b/go-auth.go index 5d2d4d8..a3c48be 100644 --- a/go-auth.go +++ b/go-auth.go @@ -726,24 +726,23 @@ func CheckBackendsAcl(username, topic, clientid string, acc int) bool { //CheckPluginAuth checks that the plugin is not nil and returns the plugins auth response. func CheckPluginAuth(username, password string) bool { - if commonData.Plugin != nil { - return commonData.PGetUser(username, password) + if commonData.Plugin == nil { + return false } - return false + return commonData.PGetUser(username, password) } //CheckPluginAcl checks that the plugin is not nil and returns the superuser/acl response. func CheckPluginAcl(username, topic, clientid string, acc int) bool { - if commonData.Plugin != nil { - //If superuser, authorize it. - aclCheck := commonData.PGetSuperuser(username) - if aclCheck { - return true - } - //Check against the plugin's check acl function. - return commonData.PCheckAcl(username, topic, clientid, acc) + if commonData.Plugin == nil { + return false + } + //If superuser, authorize it. + if commonData.PGetSuperuser(username) { + return true } - return false + //Check against the plugin's check acl function. + return commonData.PCheckAcl(username, topic, clientid, acc) } //export AuthPluginCleanup