Comments (5)
If you can reproduce this, Could you please try this?
diff --git a/xmpp.go b/xmpp.go
index e20b57a..04d377c 100644
--- a/xmpp.go
+++ b/xmpp.go
@@ -406,7 +406,7 @@ func (c *Client) init(o *Options) error {
case *saslFailure:
// v.Any is type of sub-element in failure,
// which gives a description of what failed.
- return errors.New("auth failure: " + v.Any.Local)
+ return errors.New("auth failure: " + v.Text)
default:
return errors.New("expected <success> or <failure>, got <" + name.Local + "> in " + name.Space)
}
@@ -698,7 +698,8 @@ type saslSuccess struct {
type saslFailure struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-sasl failure"`
- Any xml.Name `xml:",any"`
+ Any xml.Name
+ Text string
}
// RFC 3920 C.5 Resource binding name space
from go-xmpp.
Hi @mattn, thanks for the quick response! The diff you provided didn't quite work for me, but this does work (added xml:"text"
for it to correctly find the text element, and did a fallback to v.Any.Local
if that doesn't exist, so that auth-failure
messages still get returned properly)
diff --git a/xmpp.go b/xmpp.go
index e20b57a..04d377c 100644
--- a/xmpp.go
+++ b/xmpp.go
@@ -406,7 +406,7 @@ func (c *Client) init(o *Options) error {
case *saslFailure:
+ errorMessage := v.Text
+ if errorMessage == "" {
// v.Any is type of sub-element in failure,
- // which gives a description of what failed.
+ // which gives a description of what failed if there was no text element
+ errorMessage = v.Any.Local
+ }
- return errors.New("auth failure: " + v.Any.Local)
+ return errors.New("auth failure: " + errorMessage)
default:
return errors.New("expected <success> or <failure>, got <" + name.Local + "> in " + name.Space)
}
@@ -698,7 +698,8 @@ type saslSuccess struct {
type saslFailure struct {
XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-sasl failure"`
Any xml.Name `xml:",any"`
+ Text string `xml:"text"`
}
// RFC 3920 C.5 Resource binding name space
from go-xmpp.
Thanks. Could you please send me the diff as p-r?
from go-xmpp.
Sure thing! https://github.com/mattn/go-xmpp/pull/81/files
from go-xmpp.
Closing as this was fixed by the above pull
from go-xmpp.
Related Issues (20)
- Implement OpenPGP xep-0027 HOT 1
- XEP-0479: XMPP Compliance Suites 2023 HOT 1
- XEPs and RFCs support page with version HOT 1
- connect should use a net.Dialer or net.DialTimeout to guard against indefinitely long blocking
- User Avatar Implementation
- ServerName not used?
- Can't access error replies for IQs
- Golang XML vulnerabilities HOT 1
- Broken URL in oob message. HOT 3
- Go-xmpp doesn't forbid/filter illegal sequences
- Get body for auth success
- Extend SendPresence() to at least minimal useful form HOT 1
- Random error if multiple user send messages at a time. HOT 2
- Close Recv() before closing connection HOT 3
- No proper errror message for failed auth when using SCRAM HOT 6
- New release build? HOT 4
- xmppo/go-xmpp or mattn/go-xmpp HOT 1
- auth failure: Invalid channel binding HOT 3
- XEP-0384: OMEMO Encryption HOT 1
- auth failure: SASL negotiation is not allowed in this state HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from go-xmpp.