Fix segfault when connecting with wrong credentials.

v0.6
Martin Dosch 10 months ago
parent 3a8c00bbed
commit d56e528680
No known key found for this signature in database
GPG Key ID: 52A57CFCE13D657D

@ -7,6 +7,7 @@
- Add warning that there is no Ox support for messages of type headline. - Add warning that there is no Ox support for messages of type headline.
- Suppress warnings about reading from closed connection if go-sendxmpp closes the connection before exiting. - Suppress warnings about reading from closed connection if go-sendxmpp closes the connection before exiting.
- Remove unnecessary newlines after stanzas. - Remove unnecessary newlines after stanzas.
- Fix segfault when authentication fails due to invalid username or password.
## [v0.6.1] 2023-07-25 ## [v0.6.1] 2023-07-25
### Changed ### Changed

@ -5,7 +5,6 @@
package main package main
import ( import (
"errors"
"fmt" "fmt"
"net" "net"
"strings" "strings"
@ -34,7 +33,7 @@ func connect(options xmpp.Options, directTLS bool) (*xmpp.Client, error) {
options.Host = net.JoinHostPort(adr.Target, fmt.Sprint(adr.Port)) options.Host = net.JoinHostPort(adr.Target, fmt.Sprint(adr.Port))
// Connect to server // Connect to server
client, err := options.NewClient() client, err := options.NewClient()
if errors.Unwrap(err) == nil { if err == nil {
return client, nil return client, nil
} }
} }
@ -53,7 +52,7 @@ func connect(options xmpp.Options, directTLS bool) (*xmpp.Client, error) {
} }
// Connect to server // Connect to server
client, err := options.NewClient() client, err := options.NewClient()
if errors.Unwrap(err) == nil { if err == nil {
return client, nil return client, nil
} }
return client, fmt.Errorf("failed to connect to server: %w", err) return client, fmt.Errorf("failed to connect to server: %w", err)

Loading…
Cancel
Save