Do not use sasl2 uuid attribute.

This commit is contained in:
Martin Dosch 2024-04-07 12:45:10 +02:00
parent 986aea7957
commit 557d105238
No known key found for this signature in database
GPG Key ID: 52A57CFCE13D657D
2 changed files with 0 additions and 46 deletions

View File

@ -14,7 +14,6 @@ import (
"net/url"
"os"
"regexp"
"runtime"
"strings"
"github.com/google/uuid" // BSD-3-Clause
@ -52,36 +51,6 @@ func readFile(path string) (*bytes.Buffer, error) {
return buffer, nil
}
func getClientID(jid string) (string, error) {
var clientID string
folder := strings.Replace(strings.Replace(jid, "@", "_at_", -1), ".", "_", -1)
clientIDLoc, err := getClientIDLoc(folder)
if err != nil {
return strError, err
}
buf, err := readFile(clientIDLoc)
if err != nil {
clientID = uuid.NewString()
file, err := os.Create(clientIDLoc)
if err != nil {
return strEmpty, fmt.Errorf("getClientID: failed to create clientid file: %w", err)
}
defer file.Close()
if runtime.GOOS != "windows" {
_ = file.Chmod(os.FileMode(defaultFileRights))
} else {
_ = file.Chmod(os.FileMode(defaultFileRightsWin))
}
_, err = file.Write([]byte(clientID))
if err != nil {
return strEmpty, fmt.Errorf("getClientID: failed to write client id file: %w", err)
}
} else {
clientID = buf.String()
}
return clientID, nil
}
func getDataPath(folder string) (string, error) {
var err error
var homeDir, dataDir string
@ -117,15 +86,6 @@ func getDataPath(folder string) (string, error) {
return dataDir, nil
}
func getClientIDLoc(folder string) (string, error) {
dataDir, err := getDataPath(folder)
if err != nil {
return strError, fmt.Errorf("getClientIDLoc: %w", err)
}
dataFile := dataDir + "clientid"
return dataFile, nil
}
func getRpad(messageLength int) string {
rpadRunes := []rune("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789")
length := defaultRpadMultiple - messageLength%defaultRpadMultiple

View File

@ -263,11 +263,6 @@ func main() {
// Timeout
timeout := time.Duration(*flagTimeout) * time.Second
clientID, err := getClientID(user)
if err != nil {
fmt.Println(err)
}
// Use ALPN
var tlsConfig tls.Config
tlsConfig.ServerName = user[strings.Index(user, "@")+1:]
@ -308,7 +303,6 @@ func main() {
Mechanism: *flagSCRAMPinning,
SSDP: !*flagSSDPOff,
UserAgentSW: "go-sendxmpp",
UserAgentID: clientID,
}
// Read message from file.