Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package go-sendxmpp for openSUSE:Factory checked in at 2026-01-20 21:04:57 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/go-sendxmpp (Old) and /work/SRC/openSUSE:Factory/.go-sendxmpp.new.1928 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "go-sendxmpp" Tue Jan 20 21:04:57 2026 rev:26 rq:1328216 version:0.15.5 Changes: -------- --- /work/SRC/openSUSE:Factory/go-sendxmpp/go-sendxmpp.changes 2025-11-12 21:15:26.052766626 +0100 +++ /work/SRC/openSUSE:Factory/.go-sendxmpp.new.1928/go-sendxmpp.changes 2026-01-20 21:04:59.089115508 +0100 @@ -1,0 +2,31 @@ +Tue Jan 20 09:21:08 UTC 2026 - Michael Vetter <[email protected]> + +- Update to 0.15.5: + * Fix SASL SCRAM Downgrade Protection in case of server providing + different mechanisms for SASL and SASL2 (requires go-xmpp >0 v0.3.2). + +------------------------------------------------------------------- +Tue Jan 20 09:20:47 UTC 2026 - Michael Vetter <[email protected]> + +- Update to 0.15.4: + * http-upload: Manually set content length for HTTP request (fixes + issues with certain http modules/proxies). + +------------------------------------------------------------------- +Tue Jan 20 09:20:36 UTC 2026 - Michael Vetter <[email protected]> + +- Update to 0.15.3: + * Fix PLAIN authentication for SASL2 (requires go-xmpp >= v0.3.1). + +------------------------------------------------------------------- +Tue Jan 20 09:20:19 UTC 2026 - Michael Vetter <[email protected]> + +- Update to 0.15.2: + * Use UUIDv7 instead of UUIDv4 for stanza IDs (requires go-xmpp >= v0.2.19). + * Fix stanza syntax error for legacy PGP messages. + * Print error if legacy PGP and Ox are requested simultaneously. + * Reworked OOB file sending and http-upload to use new functions + from go-xmpp library (requires go-xmpp >= v0.3.0). + * Try password login if FAST login fails. + +------------------------------------------------------------------- Old: ---- go-sendxmpp-0.15.1.tar.gz New: ---- go-sendxmpp-0.15.5.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ go-sendxmpp.spec ++++++ --- /var/tmp/diff_new_pack.cC9kyW/_old 2026-01-20 21:05:01.237204350 +0100 +++ /var/tmp/diff_new_pack.cC9kyW/_new 2026-01-20 21:05:01.241204515 +0100 @@ -17,7 +17,7 @@ Name: go-sendxmpp -Version: 0.15.1 +Version: 0.15.5 Release: 0 Summary: A little tool to send messages to an XMPP contact or MUC License: BSD-2-Clause ++++++ _scmsync.obsinfo ++++++ --- /var/tmp/diff_new_pack.cC9kyW/_old 2026-01-20 21:05:01.281206169 +0100 +++ /var/tmp/diff_new_pack.cC9kyW/_new 2026-01-20 21:05:01.285206335 +0100 @@ -1,6 +1,6 @@ -mtime: 1762865700 -commit: 19a95658e0c457cf7ed6aa94a8e0eea9bf136f00c5a722db591c324eb6e801cf +mtime: 1768902687 +commit: fdec3a1090c74208518a8c031d24962980b4078a170ee84441a43fa598e03cd9 url: https://src.opensuse.org/xmpp/go-sendxmpp.git -revision: 19a95658e0c457cf7ed6aa94a8e0eea9bf136f00c5a722db591c324eb6e801cf +revision: fdec3a1090c74208518a8c031d24962980b4078a170ee84441a43fa598e03cd9 projectscmsync: https://src.opensuse.org/xmpp/_ObsPrj.git ++++++ _service ++++++ --- /var/tmp/diff_new_pack.cC9kyW/_old 2026-01-20 21:05:01.309207327 +0100 +++ /var/tmp/diff_new_pack.cC9kyW/_new 2026-01-20 21:05:01.313207493 +0100 @@ -3,7 +3,7 @@ <param name="url">https://salsa.debian.org/mdosch/go-sendxmpp.git</param> <param name="scm">git</param> <param name="exclude">.git</param> - <param name="revision">v0.15.1</param> + <param name="revision">v0.15.5</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">disable</param> <param name="versionrewrite-pattern">v(.*)</param> ++++++ build.specials.obscpio ++++++ ++++++ build.specials.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/.gitignore new/.gitignore --- old/.gitignore 1970-01-01 01:00:00.000000000 +0100 +++ new/.gitignore 2026-01-20 10:51:59.000000000 +0100 @@ -0,0 +1 @@ +.osc ++++++ go-sendxmpp-0.15.1.tar.gz -> go-sendxmpp-0.15.5.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.15.1/CHANGELOG.md new/go-sendxmpp-0.15.5/CHANGELOG.md --- old/go-sendxmpp-0.15.1/CHANGELOG.md 2025-10-18 13:07:18.000000000 +0200 +++ new/go-sendxmpp-0.15.5/CHANGELOG.md 2026-01-01 20:56:38.000000000 +0100 @@ -1,4 +1,24 @@ # Changelog +## [v0.15.5] 2026-01-01 +### Changed +- Fix SASL SCRAM Downgrade Protection in case of server providing different mechanisms for SASL and SASL2 (requires go-xmpp >0 v0.3.2). + +## [v0.15.4] 2025-12-22 +### Changed +- http-upload: Manually set content length for HTTP request (fixes issues with certain http modules/proxies). + +## [v0.15.3] 2025-12-11 +### Changed +- Fix PLAIN authentication for SASL2 (requires go-xmpp >= v0.3.1). + +## [v0.15.2] 2025-12-06 +### Changed +- Use UUIDv7 instead of UUIDv4 for stanza IDs (requires go-xmpp >= v0.2.19). +- Fix stanza syntax error for legacy PGP messages. +- Print error if legacy PGP and Ox are requested simultaneously. +- Reworked OOB file sending and http-upload to use new functions from go-xmpp library (requires go-xmpp >= v0.3.0). +- Try password login if FAST login fails. + ## [v0.15.1] 2025-10-18 ### Added - Add XEP-0359 Origin-ID to messages (requires go-xmpp >= v0.2.18). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.15.1/authpinning.go new/go-sendxmpp-0.15.5/authpinning.go --- old/go-sendxmpp-0.15.1/authpinning.go 2025-10-18 13:07:18.000000000 +0200 +++ new/go-sendxmpp-0.15.5/authpinning.go 2026-01-01 20:56:38.000000000 +0100 @@ -11,7 +11,7 @@ slog.Info("getting datapath for", "user", username) dataPath, err := getDataPath(fsFriendlyJid(username), true) if err != nil { - return strEmpty, fmt.Errorf("find auth pin file path: %v", err) + return strEmpty, fmt.Errorf("find auth pin file path: %w", err) } return fmt.Sprintf("%sauthpin", dataPath), nil } @@ -20,13 +20,13 @@ // Find auth pin file. authPinFile, err := findAuthPinFilePath(username) if err != nil { - return false, fmt.Errorf("parse auth pin file: %v", err) + return false, fmt.Errorf("parse auth pin file: %w", err) } // Read file. slog.Info("reading auth pin", "file", authPinFile) f, err := os.ReadFile(authPinFile) if err != nil { - return false, fmt.Errorf("parse auth pin file: %v", err) + return false, fmt.Errorf("parse auth pin file: %w", err) } // Strip trailing newline. content := strings.TrimSuffix(string(f), "\n") @@ -39,7 +39,7 @@ // Find auth pin file. authPinFile, err := findAuthPinFilePath(username) if err != nil { - return fmt.Errorf("write auth pin file: %v", err) + return fmt.Errorf("write auth pin file: %w", err) } slog.Info("writing auth pin", "file", authPinFile) err = os.WriteFile(authPinFile, []byte("noPLAIN\n"), 0o400) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.15.1/connect.go new/go-sendxmpp-0.15.5/connect.go --- old/go-sendxmpp-0.15.1/connect.go 2025-10-18 13:07:18.000000000 +0200 +++ new/go-sendxmpp-0.15.5/connect.go 2026-01-01 20:56:38.000000000 +0100 @@ -140,5 +140,5 @@ time.Sleep(sleepDuration) slog.Info("connecting to server:", "retry", i) } - return client, fmt.Errorf("connect: failed to connect to server: %v", err) + return client, fmt.Errorf("connect: failed to connect to server: %w", err) } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.15.1/const.go new/go-sendxmpp-0.15.5/const.go --- old/go-sendxmpp-0.15.1/const.go 2025-10-18 13:07:18.000000000 +0200 +++ new/go-sendxmpp-0.15.5/const.go 2026-01-01 20:56:38.000000000 +0100 @@ -5,7 +5,7 @@ package main const ( - version = "0.15.1" + version = "0.15.5" // defaults defaultBufferSize = 100 defaultConfigColumnSep = 2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.15.1/go.mod new/go-sendxmpp-0.15.5/go.mod --- old/go-sendxmpp-0.15.1/go.mod 2025-10-18 13:07:18.000000000 +0200 +++ new/go-sendxmpp-0.15.5/go.mod 2026-01-01 20:56:38.000000000 +0100 @@ -7,18 +7,18 @@ require ( github.com/ProtonMail/gopenpgp/v3 v3.3.0 github.com/beevik/etree v1.6.0 - github.com/gabriel-vasile/mimetype v1.4.10 + github.com/gabriel-vasile/mimetype v1.4.12 github.com/google/uuid v1.6.0 github.com/pborman/getopt/v2 v2.1.0 - github.com/xmppo/go-xmpp v0.2.18 - golang.org/x/crypto v0.43.0 - golang.org/x/net v0.46.0 + github.com/xmppo/go-xmpp v0.3.2 + golang.org/x/crypto v0.46.0 + golang.org/x/net v0.48.0 salsa.debian.org/mdosch/xmppsrv v0.3.3 ) require ( github.com/ProtonMail/go-crypto v1.3.0 // indirect - github.com/cloudflare/circl v1.6.1 // indirect - golang.org/x/sys v0.37.0 // indirect - golang.org/x/text v0.30.0 // indirect + github.com/cloudflare/circl v1.6.2 // indirect + golang.org/x/sys v0.39.0 // indirect + golang.org/x/text v0.32.0 // indirect ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.15.1/go.sum new/go-sendxmpp-0.15.5/go.sum --- old/go-sendxmpp-0.15.1/go.sum 2025-10-18 13:07:18.000000000 +0200 +++ new/go-sendxmpp-0.15.5/go.sum 2026-01-01 20:56:38.000000000 +0100 @@ -4,12 +4,12 @@ github.com/ProtonMail/gopenpgp/v3 v3.3.0/go.mod h1:J+iNPt0/5EO9wRt7Eit9dRUlzyu3hiGX3zId6iuaKOk= github.com/beevik/etree v1.6.0 h1:u8Kwy8pp9D9XeITj2Z0XtA5qqZEmtJtuXZRQi+j03eE= github.com/beevik/etree v1.6.0/go.mod h1:bh4zJxiIr62SOf9pRzN7UUYaEDa9HEKafK25+sLc0Gc= -github.com/cloudflare/circl v1.6.1 h1:zqIqSPIndyBh1bjLVVDHMPpVKqp8Su/V+6MeDzzQBQ0= -github.com/cloudflare/circl v1.6.1/go.mod h1:uddAzsPgqdMAYatqJ0lsjX1oECcQLIlRpzZh3pJrofs= +github.com/cloudflare/circl v1.6.2 h1:hL7VBpHHKzrV5WTfHCaBsgx/HGbBYlgrwvNXEVDYYsQ= +github.com/cloudflare/circl v1.6.2/go.mod h1:2eXP6Qfat4O/Yhh8BznvKnJ+uzEoTQ6jVKJRn81BiS4= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= -github.com/gabriel-vasile/mimetype v1.4.10 h1:zyueNbySn/z8mJZHLt6IPw0KoZsiQNszIpU+bX4+ZK0= -github.com/gabriel-vasile/mimetype v1.4.10/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= +github.com/gabriel-vasile/mimetype v1.4.12 h1:e9hWvmLYvtp846tLHam2o++qitpguFiYCKbn0w9jyqw= +github.com/gabriel-vasile/mimetype v1.4.12/go.mod h1:d+9Oxyo1wTzWdyVUPMmXFvp4F9tea18J8ufA774AB3s= github.com/google/uuid v1.6.0 h1:NIvaJDMOsjHA8n1jAhLSgzrAzy1Hgr+hNrb57e+94F0= github.com/google/uuid v1.6.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/pborman/getopt/v2 v2.1.0 h1:eNfR+r+dWLdWmV8g5OlpyrTYHkhVNxHBdN2cCrJmOEA= @@ -18,16 +18,16 @@ github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= github.com/stretchr/testify v1.10.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= -github.com/xmppo/go-xmpp v0.2.18 h1:MSTzKqYsAFxPCXkha36qxn09oXQ8Scnsk7OqgoiIVto= -github.com/xmppo/go-xmpp v0.2.18/go.mod h1:hLa9WAf0VRpSVguhme06Df+7mIQ6enCEG8udUNYcqX4= -golang.org/x/crypto v0.43.0 h1:dduJYIi3A3KOfdGOHX8AVZ/jGiyPa3IbBozJ5kNuE04= -golang.org/x/crypto v0.43.0/go.mod h1:BFbav4mRNlXJL4wNeejLpWxB7wMbc79PdRGhWKncxR0= -golang.org/x/net v0.46.0 h1:giFlY12I07fugqwPuWJi68oOnpfqFnJIJzaIIm2JVV4= -golang.org/x/net v0.46.0/go.mod h1:Q9BGdFy1y4nkUwiLvT5qtyhAnEHgnQ/zd8PfU6nc210= -golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= -golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k= -golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM= +github.com/xmppo/go-xmpp v0.3.2 h1:RAQf7yD2XNH1UAy4OPlofnI2qLVx1iQzAR7ghptvaA8= +github.com/xmppo/go-xmpp v0.3.2/go.mod h1:EBLbzPt4Y9OJBEF58Lhc4IrTnO226aIkbfosQo6KWeA= +golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU= +golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0= +golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU= +golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY= +golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= +golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU= +golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= salsa.debian.org/mdosch/xmppsrv v0.3.3 h1:F8FGyw1Q1LkAs/UbIXd6Obd33q2CKWrIxxrzvuLSVuM= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.15.1/helpers.go new/go-sendxmpp-0.15.5/helpers.go --- old/go-sendxmpp-0.15.1/helpers.go 2025-10-18 13:07:18.000000000 +0200 +++ new/go-sendxmpp-0.15.5/helpers.go 2026-01-01 20:56:38.000000000 +0100 @@ -266,7 +266,11 @@ } func getID() string { - return uuid.NewString() + id, err := uuid.NewV7() + if err != nil { + log.Fatal(err) + } + return id.String() } func getShortID() string { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.15.1/httpupload.go new/go-sendxmpp-0.15.5/httpupload.go --- old/go-sendxmpp-0.15.1/httpupload.go 2025-10-18 13:07:18.000000000 +0200 +++ new/go-sendxmpp-0.15.5/httpupload.go 2026-01-01 20:56:38.000000000 +0100 @@ -24,11 +24,16 @@ "github.com/xmppo/go-xmpp" // BSD-3-Clause ) -func httpUpload(client *xmpp.Client, iqc chan xmpp.IQ, disc chan xmpp.DiscoItems, drc chan xmpp.DiscoResult, +func httpUpload(client *xmpp.Client, iqc chan xmpp.IQ, disc chan xmpp.DiscoItems, drc chan xmpp.DiscoResult, slc chan xmpp.Slot, jserver string, filePaths []string, timeout time.Duration, oxPrivKey *crypto.Key, keyRing *crypto.KeyRing, ) (urls []string, err error) { - var uploadComponent string - var maxFileSize int64 + var ( + uploadComponent string + maxFileSize int64 + req *http.Request + ) + + buffer := new(bytes.Buffer) // Query server for disco#items slog.Info("http-upload: querying disco items", "server", jserver) @@ -82,23 +87,37 @@ } for _, filePath := range filePaths { // Read file - buffer, err := readFile(filePath) + file, err := os.Open(filePath) if err != nil { - return urls, err + return urls, fmt.Errorf("http-upload: read file: %w", err) + } + defer file.Close() + + fileStat, err := file.Stat() + if err != nil { + return urls, fmt.Errorf("http-upload: stat file: %w", err) } - fileSize := buffer.Len() + fileSize := fileStat.Size() slog.Info("http-upload: checking file size:", "file", filePath, "size", fileSize) // Get mime type - mimeType := mimetype.Detect(buffer.Bytes()).String() + mtype, err := mimetype.DetectFile(filePath) + if err != nil { + return urls, fmt.Errorf("http-upload: detect mimetype: %w", err) + } + mimeType := mtype.String() slog.Info("http-upload:", "mime type", mimeType) var mimeTypeEscaped bytes.Buffer xml.Escape(&mimeTypeEscaped, []byte(mimeType)) if oxPrivKey != nil { + _, err = readFile(filePath) + if err != nil { + return nil, fmt.Errorf("http-upload: %w", err) + } buffer, err = legacyPGPEncryptFile(oxPrivKey, keyRing, buffer) if err != nil { return urls, err } - fileSize = buffer.Len() + fileSize = int64(buffer.Len()) slog.Info("http-upload: updated file size after encrypting:", "file", filePath, "size", fileSize) } // Get file name @@ -136,35 +155,15 @@ // Request http upload slot slog.Info("http-upload: requesting upload slot") - uploadSlot, err := sendIQ(client, iqc, uploadComponent, "get", r) - if err != nil { - return urls, err - } - if uploadSlot.Type != strResult { - return urls, fmt.Errorf("http-upload: error while requesting upload slot") - } - iqHTTPUploadSlotXML := etree.NewDocument() - err = iqHTTPUploadSlotXML.ReadFromBytes(uploadSlot.Query) + uploadSlot, err := getSlot(client, slc, uploadComponent, r) if err != nil { return urls, err } - iqHTTPUploadSlotXMLSlot := iqHTTPUploadSlotXML.SelectElement("slot") - if iqHTTPUploadSlotXMLSlot == nil { - return urls, fmt.Errorf("http-upload: no slot element") - } - iqHTTPUploadSlotXMLPut := iqHTTPUploadSlotXMLSlot.SelectElement("put") - if iqHTTPUploadSlotXMLPut == nil { - return urls, fmt.Errorf("http-upload: no put element") - } - iqHTTPUploadSlotXMLPutURL := iqHTTPUploadSlotXMLPut.SelectAttr("url") - if iqHTTPUploadSlotXMLPutURL == nil { - return urls, fmt.Errorf("http-upload: no url attribute") - } - if !strings.HasPrefix(iqHTTPUploadSlotXMLPutURL.Value, "https://") { + if !strings.HasPrefix(uploadSlot.Put.Url, "https://") { return urls, fmt.Errorf("http-upload: upload slot does not provide https") } // Upload file - slog.Info("http-upload: uploading file to", "slot", iqHTTPUploadSlotXMLPutURL.Value) + slog.Info("http-upload: uploading file to", "slot", uploadSlot.Put.Url) httpTransport := &http.Transport{ IdleConnTimeout: timeout, TLSHandshakeTimeout: timeout, @@ -180,21 +179,23 @@ httpTransport.Proxy = http.ProxyURL(proxyURL) } httpClient := &http.Client{Transport: httpTransport} - req, err := http.NewRequest(http.MethodPut, iqHTTPUploadSlotXMLPutURL.Value, - buffer) + if oxPrivKey != nil { + req, err = http.NewRequest(http.MethodPut, uploadSlot.Put.Url, buffer) + } else { + req, err = http.NewRequest(http.MethodPut, uploadSlot.Put.Url, file) + } if err != nil { return urls, err } + req.ContentLength = fileSize req.Header.Set("Content-Type", mimeTypeEscaped.String()) - iqHTTPUploadSlotXMLPutHeaders := iqHTTPUploadSlotXMLPut.SelectElements("header") - for _, h := range iqHTTPUploadSlotXMLPutHeaders { - name := h.SelectAttr("name") - if name == nil { + for _, h := range uploadSlot.Put.Headers { + if h.Name == strEmpty { continue } - switch name.Value { + switch h.Name { case "Authorization", "Cookie", "Expires": - req.Header.Set(name.Value, h.Text()) + req.Header.Set(h.Name, h.Value) } } resp, err := httpClient.Do(req) @@ -208,20 +209,19 @@ } // Return http link - iqHTTPUploadSlotXMLGet := iqHTTPUploadSlotXMLSlot.SelectElement("get") - if iqHTTPUploadSlotXMLGet == nil { - return urls, fmt.Errorf("http-upload: no get element") - } - iqHTTPUploadSlotXMLGetURL := iqHTTPUploadSlotXMLGet.SelectAttr("url") - if iqHTTPUploadSlotXMLGetURL == nil { + if uploadSlot.Get.Url == strEmpty { return urls, fmt.Errorf("http-upload: no url attribute") } - slog.Info("http-upload: received get", "URL", iqHTTPUploadSlotXMLGetURL.Value) + if !strings.HasPrefix(uploadSlot.Get.Url, "https://") { + return urls, fmt.Errorf("http-upload: get url does not provide https") + } + slog.Info("http-upload: received get", "URL", uploadSlot.Get.Url) err = resp.Body.Close() if err != nil { fmt.Println("http-upload: error while closing http request body:", err) } - urls = append(urls, iqHTTPUploadSlotXMLGetURL.Value) + urls = append(urls, uploadSlot.Get.Url) + file.Close() } return urls, nil } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.15.1/jid.go new/go-sendxmpp-0.15.5/jid.go --- old/go-sendxmpp-0.15.1/jid.go 2025-10-18 13:07:18.000000000 +0200 +++ new/go-sendxmpp-0.15.5/jid.go 2026-01-01 20:56:38.000000000 +0100 @@ -46,11 +46,11 @@ sep = strings.Index(s, "@") - switch { - case sep == -1: + switch sep { + case -1: // There is no @ sign, and therefore no localpart. domainpart = s - case sep == 0: + case 0: // The JID starts with an @ sign (invalid empty localpart) err = fmt.Errorf("invalid jid: %s", input) return input, err diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.15.1/legacypgp.go new/go-sendxmpp-0.15.5/legacypgp.go --- old/go-sendxmpp-0.15.1/legacypgp.go 2025-10-18 13:07:18.000000000 +0200 +++ new/go-sendxmpp-0.15.5/legacypgp.go 2026-01-01 20:56:38.000000000 +0100 @@ -62,7 +62,7 @@ legacyPGPMsgEnc := legacyPGPMsg.CreateElement("encryption") legacyPGPMsgEnc.CreateAttr("namespace", nsJabberEncrypted) legacyPGPMsgEnc.CreateAttr("xmlns", nsEme) - legacyPGPMsgOrigID := legacyPGP.CreateElement("origin-id") + legacyPGPMsgOrigID := legacyPGPMsg.CreateElement("origin-id") legacyPGPMsgOrigID.CreateAttr("xmlns", nsSid) legacyPGPMsgOrigID.CreateAttr("id", id) pgpEncrypt, err := crypto.PGP().Encryption(). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.15.1/main.go new/go-sendxmpp-0.15.5/main.go --- old/go-sendxmpp-0.15.1/main.go 2025-10-18 13:07:18.000000000 +0200 +++ new/go-sendxmpp-0.15.5/main.go 2026-01-01 20:56:38.000000000 +0100 @@ -38,7 +38,7 @@ func closeAndExit(client *xmpp.Client, err error) { slog.Info("closing connection and exiting") - client.Close() + _ = client.Close() if err != nil { log.Fatal(err) } @@ -186,6 +186,8 @@ case len(*flagHTTPUpload) != 0 && *flagMessageFile != "": log.Fatal("You can't send a message while using" + " http upload.") + case *flagOx && *flagLegacyPGP: + log.Fatal("Ox and legacy PGP can't be used simultaneously.") case (*flagOx || *flagLegacyPGP) && *flagOOBFile != "": log.Fatal("No encryption possible for OOB data.") case (*flagOx || *flagLegacyPGP) && *flagHeadline: @@ -213,7 +215,7 @@ slog.Info("checking if OS user is root") if currUser.Username == "root" { fmt.Println("WARNING: It seems you are running go-sendxmpp as root user.\n" + - "This is is not recommended as go-sendxmpp does not require root " + + "This is not recommended as go-sendxmpp does not require root " + "privileges. Please consider using a less privileged user. For an " + "example how to do this with sudo please consult the manpage chapter " + "TIPS.") @@ -436,6 +438,10 @@ NoSASLUpgrade: *flagNoSASLUpgrade, PeriodicServerPings: psp, PeriodicServerPingsPeriod: pspPeriod, + ReportSoftwareVersion: true, + SoftwareName: "go-sendxmpp", + SoftwareVersion: version, + ReportSoftwareOS: true, } slog.Info("setting xmpp connection option:", "Host", server) slog.Info("setting xmpp connection option:", "User", user) @@ -508,7 +514,13 @@ client, err := connect(options, *flagDirectTLS, *flagAnon, *flagRetryConnect, *flagRetryConnectMax) if err != nil { if fast.Token != "" { - log.Fatal(fmt.Errorf("could not connect using FAST authentication: %v", err)) + slog.Info("failed connecting using fast", "mechanism", options.FastMechanism, "token", options.FastToken) + options.FastToken = "" + options.FastMechanism = "" + client, err = connect(options, *flagDirectTLS, *flagAnon, *flagRetryConnect, *flagRetryConnectMax) + if err != nil { + log.Fatal(err) + } } else { log.Fatal(err) } @@ -553,9 +565,10 @@ prsc := make(chan xmpp.Presence, defaultBufferSize) disc := make(chan xmpp.DiscoItems, defaultBufferSize) drc := make(chan xmpp.DiscoResult, defaultBufferSize) + slc := make(chan xmpp.Slot, defaultBufferSize) ctx, cancel := context.WithCancel(context.Background()) slog.Info("starting to receive stanzas") - go rcvStanzas(client, ctx, iqc, msgc, prsc, disc, drc) + go rcvStanzas(client, ctx, iqc, msgc, prsc, disc, drc, slc) for _, r := range recipientsList { var re recipientsType re.Jid = r @@ -662,7 +675,7 @@ var uploadMessages []string if len(*flagHTTPUpload) != 0 && !*flagLegacyPGP { slog.Info("http-upload:", "file", *flagHTTPUpload) - uploadMessages, err = httpUpload(client, iqc, disc, drc, + uploadMessages, err = httpUpload(client, iqc, disc, drc, slc, jserver, *flagHTTPUpload, timeout, nil, nil) if err != nil { cancel() @@ -939,10 +952,9 @@ case len(*flagHTTPUpload) != 0 && !*flagLegacyPGP: for _, message = range uploadMessages { slog.Info("sending http-upload message:", "file", message, "JID", recipient.Jid) - _, err = client.Send(xmpp.Chat{ + _, err = client.SendOOB(xmpp.Chat{ Remote: recipient.Jid, - Type: msgType, Ooburl: message, Text: message, - Subject: *flagSubject, + Type: msgType, Oob: xmpp.Oob{Url: message}, Subject: *flagSubject, }) if err != nil { fmt.Println("Couldn't send message to", @@ -950,7 +962,7 @@ } } case len(*flagHTTPUpload) != 0 && *flagLegacyPGP: - uploadMessages, err = httpUpload(client, iqc, disc, drc, + uploadMessages, err = httpUpload(client, iqc, disc, drc, slc, jserver, *flagHTTPUpload, timeout, oxPrivKey, recipient.OxKeyRing) if err != nil { cancel() @@ -958,10 +970,9 @@ } for _, message = range uploadMessages { slog.Info("sending legacy pgp http-upload message:", "file", message, "JID", recipient.Jid) - _, err = client.Send(xmpp.Chat{ + _, err = client.SendOOB(xmpp.Chat{ Remote: recipient.Jid, - Type: msgType, Ooburl: message, Text: message, - Subject: *flagSubject, + Type: msgType, Oob: xmpp.Oob{Url: message}, Subject: *flagSubject, }) if err != nil { fmt.Println("Couldn't send message to", @@ -972,17 +983,10 @@ // (Hopefully) temporary workaround due to go-xmpp choking on URL encoding. // Once this is fixed in the lib the http-upload case above can be reused. case *flagOOBFile != "": - var msg string - if *flagSubject != "" { - msg = fmt.Sprintf("<message to='%s' type='%s'><subject>%s</subject><body>%s</body><x xmlns='jabber:x:oob'><url>%s</url></x></message>", - recipient.Jid, msgType, *flagSubject, message, message) - slog.Info("sending OOB message:", "uri", message, "subject", *flagSubject, "JID", recipient.Jid) - } else { - msg = fmt.Sprintf("<message to='%s' type='%s'><body>%s</body><x xmlns='jabber:x:oob'><url>%s</url></x></message>", - recipient.Jid, msgType, message, message) - slog.Info("sending OOB message:", "uri", message, "JID", recipient.Jid) - } - _, err = client.SendOrg(msg) + _, err = client.SendOOB(xmpp.Chat{ + Remote: recipient.Jid, + Type: msgType, Oob: xmpp.Oob{Url: message}, Subject: *flagSubject, + }) if err != nil { fmt.Println("Couldn't send message to", recipient.Jid) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.15.1/stanzahandling.go new/go-sendxmpp-0.15.5/stanzahandling.go --- old/go-sendxmpp-0.15.1/stanzahandling.go 2025-10-18 13:07:18.000000000 +0200 +++ new/go-sendxmpp-0.15.5/stanzahandling.go 2026-01-01 20:56:38.000000000 +0100 @@ -12,7 +12,6 @@ "io" "log" "log/slog" - "runtime" "strings" "time" @@ -23,7 +22,7 @@ func getDiscoInfo(client *xmpp.Client, drc chan xmpp.DiscoResult, target string) (dr xmpp.DiscoResult, err error) { id := getID() c := make(chan xmpp.DiscoResult, defaultBufferSize) - go getDr(target, c, drc) + go getDr(c, drc) slog.Info("stanzahandling: requesting disco info") _, err = client.RawInformation(client.JID(), target, id, "get", fmt.Sprintf("<query xmlns='%s'/>", nsDiscoInfo)) @@ -40,7 +39,7 @@ return dr, err } -func getDr(jid string, c chan xmpp.DiscoResult, drc chan xmpp.DiscoResult) { +func getDr(c chan xmpp.DiscoResult, drc chan xmpp.DiscoResult) { for { dr := <-drc c <- dr @@ -48,6 +47,33 @@ } } +func getSlot(client *xmpp.Client, slc chan xmpp.Slot, target, request string) (sl xmpp.Slot, err error) { + id := getID() + c := make(chan xmpp.Slot, defaultBufferSize) + go getSl(c, slc) + slog.Info("stanzahandling: requesting upload slot") + _, err = client.RawInformation(client.JID(), target, id, "get", request) + if err != nil { + return sl, fmt.Errorf("get slot: failed to send iq: %w", err) + } + select { + case sl = <-c: + slog.Info("stanzahandling: requesting upload slot: received reply") + case <-time.After(60 * time.Second): + slog.Info("stanzahandling: requesting upload slot: timeout") + return sl, fmt.Errorf("get upload slot: %s didn't reply to upload slot request", target) + } + return sl, err +} + +func getSl(c chan xmpp.Slot, slc chan xmpp.Slot) { + for { + sl := <-slc + c <- sl + return + } +} + func getDiscoItems(client *xmpp.Client, disc chan xmpp.DiscoItems, target string) (dis xmpp.DiscoItems, err error) { id := getID() c := make(chan xmpp.DiscoItems, defaultBufferSize) @@ -116,7 +142,7 @@ } } -func rcvStanzas(client *xmpp.Client, ctx context.Context, iqc chan xmpp.IQ, msgc chan xmpp.Chat, prsc chan xmpp.Presence, disc chan xmpp.DiscoItems, drc chan xmpp.DiscoResult) { +func rcvStanzas(client *xmpp.Client, ctx context.Context, iqc chan xmpp.IQ, msgc chan xmpp.Chat, prsc chan xmpp.Presence, disc chan xmpp.DiscoItems, drc chan xmpp.DiscoResult, slc chan xmpp.Slot) { type messageError struct { XMLName xml.Name `xml:"message-error"` Text string `xml:"text"` @@ -151,7 +177,7 @@ case nil: continue default: - closeAndExit(client, fmt.Errorf("receive stanzas: %v", err)) + closeAndExit(client, fmt.Errorf("receive stanzas: %w", err)) return } case received = <-r: @@ -174,6 +200,8 @@ disc <- v case xmpp.DiscoResult: drc <- v + case xmpp.Slot: + slc <- v case xmpp.IQ: switch v.Type { case "get": @@ -213,29 +241,6 @@ xmlString, err := root.WriteToString() if err == nil { _, err = client.SendOrg(xmlString) - if err != nil { - log.Println(err) - } - } - case nsVersion: - root := etree.NewDocument() - root.WriteSettings.AttrSingleQuote = true - reply := root.CreateElement("iq") - reply.CreateAttr("type", "result") - reply.CreateAttr("from", client.JID()) - reply.CreateAttr("to", v.From) - reply.CreateAttr("id", v.ID) - replyQuery := reply.CreateElement("query") - replyQuery.CreateAttr("xmlns", nsVersion) - rqName := replyQuery.CreateElement("name") - rqName.CreateText("go-sendxmpp") - rqVersion := replyQuery.CreateElement("version") - rqVersion.CreateText(version) - rqOS := replyQuery.CreateElement("os") - rqOS.CreateText(runtime.GOOS) - xmlString, err := root.WriteToString() - if err == nil { - _, err = client.SendOrg(xmlString) if err != nil { log.Println(err) } ++++++ vendor.tar.gz ++++++ ++++ 12233 lines of diff (skipped)
