Changeset 725 in code for trunk/upstream.go


Ignore:
Timestamp:
Nov 21, 2021, 3:28:38 PM (4 years ago)
Author:
contact
Message:

Remove sasl cap after registration if network doesn't support it

This will stop clients from trying to issue AUTHENTICATE requests
after connection registration.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/upstream.go

    r724 r725  
    17321732}
    17331733
     1734func (uc *upstreamConn) supportsSASL(mech string) bool {
     1735        v, ok := uc.supportedCaps["sasl"]
     1736        if !ok {
     1737                return false
     1738        }
     1739
     1740        if v == "" {
     1741                return true
     1742        }
     1743
     1744        mechanisms := strings.Split(v, ",")
     1745        for _, mech := range mechanisms {
     1746                if strings.EqualFold(mech, mech) {
     1747                        return true
     1748                }
     1749        }
     1750        return false
     1751}
     1752
    17341753func (uc *upstreamConn) requestSASL() bool {
    17351754        if uc.network.SASL.Mechanism == "" {
    17361755                return false
    17371756        }
    1738 
    1739         v, ok := uc.supportedCaps["sasl"]
    1740         if !ok {
    1741                 return false
    1742         }
    1743         if v != "" {
    1744                 mechanisms := strings.Split(v, ",")
    1745                 found := false
    1746                 for _, mech := range mechanisms {
    1747                         if strings.EqualFold(mech, uc.network.SASL.Mechanism) {
    1748                                 found = true
    1749                                 break
    1750                         }
    1751                 }
    1752                 if !found {
    1753                         return false
    1754                 }
    1755         }
    1756 
    1757         return true
     1757        return uc.supportsSASL(uc.network.SASL.Mechanism)
    17581758}
    17591759
Note: See TracChangeset for help on using the changeset viewer.