Changeset 725 in code
- Timestamp:
- Nov 21, 2021, 3:28:38 PM (4 years ago)
- Location:
- trunk
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/downstream.go
r724 r725 191 191 "invite-notify": "", 192 192 "message-tags": "", 193 "sasl": "PLAIN",194 193 "server-time": "", 195 194 "setname": "", … … 300 299 dc.supportedCaps[k] = v 301 300 } 301 dc.supportedCaps["sasl"] = "PLAIN" 302 302 // TODO: this is racy, we should only enable chathistory after 303 303 // authentication and then check that user.msgStore implements … … 1037 1037 dc.unsetSupportedCap(cap) 1038 1038 } 1039 } 1040 1041 if uc := dc.upstream(); uc != nil && uc.supportsSASL("PLAIN") { 1042 dc.setSupportedCap("sasl", "PLAIN") 1043 } else if dc.network != nil { 1044 dc.unsetSupportedCap("sasl") 1039 1045 } 1040 1046 -
trunk/upstream.go
r724 r725 1732 1732 } 1733 1733 1734 func (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 1734 1753 func (uc *upstreamConn) requestSASL() bool { 1735 1754 if uc.network.SASL.Mechanism == "" { 1736 1755 return false 1737 1756 } 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) 1758 1758 } 1759 1759
Note:
See TracChangeset
for help on using the changeset viewer.