Skip to content

Commit

Permalink
Tidy up plugin checks.
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignacio Gómez committed Sep 27, 2019
1 parent 51f2915 commit 5485ce1
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions go-auth.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 5485ce1

Please sign in to comment.