commit go-sendxmpp for openSUSE:Factory
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 2024-06-03 17:40:50 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/go-sendxmpp (Old) and /work/SRC/openSUSE:Factory/.go-sendxmpp.new.24587 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Package is "go-sendxmpp" Mon Jun 3 17:40:50 2024 rev:16 rq:1177829 version:0.11.0 Changes: -------- --- /work/SRC/openSUSE:Factory/go-sendxmpp/go-sendxmpp.changes 2024-04-15 20:24:11.781296012 +0200 +++ /work/SRC/openSUSE:Factory/.go-sendxmpp.new.24587/go-sendxmpp.changes 2024-06-03 17:40:51.997268674 +0200 @@ -1,0 +2,12 @@ +Fri May 31 04:53:19 UTC 2024 - Michael Vetter <mvetter@suse.com> + +- Update to 0.11.0: + Changed: + * Move private Ox key into JID folder in ~/.local/share/go-sendxmpp. + * Use fmt.Errorf() instead of errors.New() to create new error messages. + Added: + * Add new parameter --subject. + * Added flag --fast-off to disable XEP-0484: Fast Authentication + Streamlining Tokens (requires go-xmpp >= 0.2.1) + +------------------------------------------------------------------- Old: ---- go-sendxmpp-0.10.0.tar.gz New: ---- go-sendxmpp-0.11.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ go-sendxmpp.spec ++++++ --- /var/tmp/diff_new_pack.ZAYysn/_old 2024-06-03 17:40:54.097345728 +0200 +++ /var/tmp/diff_new_pack.ZAYysn/_new 2024-06-03 17:40:54.113346315 +0200 @@ -17,7 +17,7 @@ Name: go-sendxmpp -Version: 0.10.0 +Version: 0.11.0 Release: 0 Summary: A little tool to send messages to an XMPP contact or MUC License: BSD-2-Clause ++++++ _service ++++++ --- /var/tmp/diff_new_pack.ZAYysn/_old 2024-06-03 17:40:54.417357470 +0200 +++ /var/tmp/diff_new_pack.ZAYysn/_new 2024-06-03 17:40:54.449358644 +0200 @@ -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.10.0</param> + <param name="revision">v0.11.0</param> <param name="versionformat">@PARENT_TAG@</param> <param name="changesgenerate">disable</param> <param name="versionrewrite-pattern">v(.*)</param> ++++++ go-sendxmpp-0.10.0.tar.gz -> go-sendxmpp-0.11.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.10.0/.gitlab-ci.yml new/go-sendxmpp-0.11.0/.gitlab-ci.yml --- old/go-sendxmpp-0.10.0/.gitlab-ci.yml 2024-04-13 12:17:18.000000000 +0200 +++ new/go-sendxmpp-0.11.0/.gitlab-ci.yml 2024-05-29 18:51:52.000000000 +0200 @@ -45,11 +45,17 @@ stage: build only: - tags + before_script: + - echo "deb https://deb.debian.org/debian/ bookworm-backports main" >> /etc/apt/sources.list + - apt-get -qq update && apt-get -qq install -y upx-ucl script: - echo "${CI_JOB_ID}" > CI_JOB_ID.txt - env GOOS=linux GOARCH=amd64 go build -buildmode=pie -ldflags "-s -w -extldflags '-static'" -o $CI_PROJECT_DIR/linux-amd64/go-sendxmpp + - upx $CI_PROJECT_DIR/linux-amd64/go-sendxmpp || true - env GOOS=linux GOARCH=arm64 go build -buildmode=pie -ldflags "-s -w -extldflags '-static'" -o $CI_PROJECT_DIR/linux-arm64/go-sendxmpp + - upx $CI_PROJECT_DIR/linux-arm64/go-sendxmpp || true - env GOOS=windows GOARCH=amd64 go build -buildmode=pie -ldflags "-s -w -extldflags '-static'" -o $CI_PROJECT_DIR/win64/go-sendxmpp.exe + - upx $CI_PROJECT_DIR/win64/go-sendxmpp.exe || true artifacts: paths: - linux-amd64/go-sendxmpp diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.10.0/CHANGELOG.md new/go-sendxmpp-0.11.0/CHANGELOG.md --- old/go-sendxmpp-0.10.0/CHANGELOG.md 2024-04-13 12:17:18.000000000 +0200 +++ new/go-sendxmpp-0.11.0/CHANGELOG.md 2024-05-29 18:51:52.000000000 +0200 @@ -1,5 +1,14 @@ # Changelog +## [v0.11.0] 2024-05-29 +### Changed +- Move private Ox key into JID folder in ~/.local/share/go-sendxmpp. +- Use `fmt.Errorf()` instead of `errors.New()` to create new error messages. + +### Added +- Add new parameter `--subject`. +- Added flag `--fast-off` to disable XEP-0484: Fast Authentication Streamlining Tokens (requires go-xmpp >= 0.2.1). + ## [v0.10.0] 2024-04-13 ### Changed - Fixed a race condition in receiving stanzas (requires go-xmpp >= v0.1.5). diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.10.0/README.md new/go-sendxmpp-0.11.0/README.md --- old/go-sendxmpp-0.10.0/README.md 2024-04-13 12:17:18.000000000 +0200 +++ new/go-sendxmpp-0.11.0/README.md 2024-05-29 18:51:52.000000000 +0200 @@ -75,10 +75,11 @@ the account details via command line options: ```plain -Usage: go-sendxmpp [-cdilnt] [-a value] [-f value] [--headline] [--help] [-h value] [-j value] [-m value] [--muc-password value] [--oob-file value] [--ox] [--ox-delete-nodes] [--ox-genprivkey-rsa] [--ox-genprivkey-x25519] [--ox-import-privkey value] [--ox-passphrase value] [-p value] [--raw] [--scram-mech-pinning value] [--ssdp-off] [--timeout value] [--tls-version value] [-u value] [--version] [recipients…] +Usage: go-sendxmpp [-cdilnt] [-a value] [--fast-off] [-f value] [--headline] [--help] [-h value] [-j value] [-m value] [--muc-password value] [--oob-file value] [--ox] [--ox-delete-nodes] [--ox-genprivkey-rsa] [--ox-genprivkey-x25519] [--ox-import-privkey value] [--ox-passphrase value] [-p value] [--raw] [--scram-mech-pinning value] [--ssdp-off] [-s value] [--timeout value] [--tls-version value] [-u value] [--version] [recipients…] -a, --alias=value Set alias/nicknamefor chatrooms. -c, --chatroom Send message to a chatroom. -d, --debug Show debugging info. + --fast-off Disable XEP-0484: Fast Authentication Streamlining Tokens. -f, --file=value Set configuration file. (Default: ~/.config/go-sendxmpp/sendxmpprc) --headline Send message as type headline. @@ -117,6 +118,8 @@ --scram-mech-pinning=value Enforce the use of a certain SCRAM authentication mechanism. --ssdp-off Disable XEP-0474: SASL SCRAM Downgrade Protection. + -s, --subject=value + Set message subject. --timeout=value Connection timeout in seconds. [10] -t, --tls Use direct TLS. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.10.0/const.go new/go-sendxmpp-0.11.0/const.go --- old/go-sendxmpp-0.10.0/const.go 2024-04-13 12:17:18.000000000 +0200 +++ new/go-sendxmpp-0.11.0/const.go 2024-05-29 18:51:52.000000000 +0200 @@ -5,7 +5,7 @@ package main const ( - version = "0.10.0" + version = "0.11.0" // defaults defaultBufferSize = 100 defaultConfigRowSep = 2 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.10.0/go.mod new/go-sendxmpp-0.11.0/go.mod --- old/go-sendxmpp-0.10.0/go.mod 2024-04-13 12:17:18.000000000 +0200 +++ new/go-sendxmpp-0.11.0/go.mod 2024-05-29 18:51:52.000000000 +0200 @@ -4,21 +4,21 @@ require ( github.com/ProtonMail/gopenpgp/v2 v2.7.5 - github.com/beevik/etree v1.3.0 - github.com/gabriel-vasile/mimetype v1.4.3 + github.com/beevik/etree v1.4.0 + github.com/gabriel-vasile/mimetype v1.4.4 github.com/google/uuid v1.6.0 github.com/pborman/getopt/v2 v2.1.0 - github.com/xmppo/go-xmpp v0.2.0 - golang.org/x/crypto v0.22.0 + github.com/xmppo/go-xmpp v0.2.1 + golang.org/x/crypto v0.23.0 salsa.debian.org/mdosch/xmppsrv v0.2.6 ) require ( github.com/ProtonMail/go-crypto v1.0.0 // indirect github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f // indirect - github.com/cloudflare/circl v1.3.7 // indirect + github.com/cloudflare/circl v1.3.8 // indirect github.com/pkg/errors v0.9.1 // indirect - golang.org/x/net v0.24.0 // indirect - golang.org/x/sys v0.19.0 // indirect - golang.org/x/text v0.14.0 // indirect + golang.org/x/net v0.25.0 // indirect + golang.org/x/sys v0.20.0 // indirect + golang.org/x/text v0.15.0 // indirect ) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.10.0/go.sum new/go-sendxmpp-0.11.0/go.sum --- old/go-sendxmpp-0.10.0/go.sum 2024-04-13 12:17:18.000000000 +0200 +++ new/go-sendxmpp-0.11.0/go.sum 2024-05-29 18:51:52.000000000 +0200 @@ -5,17 +5,17 @@ github.com/ProtonMail/go-mime v0.0.0-20230322103455-7d82a3887f2f/go.mod h1:gcr0kNtGBqin9zDW9GOHcVntrwnjrK+qdJ06mWYBybw= github.com/ProtonMail/gopenpgp/v2 v2.7.5 h1:STOY3vgES59gNgoOt2w0nyHBjKViB/qSg7NjbQWPJkA= github.com/ProtonMail/gopenpgp/v2 v2.7.5/go.mod h1:IhkNEDaxec6NyzSI0PlxapinnwPVIESk8/76da3Ct3g= -github.com/beevik/etree v1.3.0 h1:hQTc+pylzIKDb23yYprodCWWTt+ojFfUZyzU09a/hmU= -github.com/beevik/etree v1.3.0/go.mod h1:aiPf89g/1k3AShMVAzriilpcE4R/Vuor90y83zVZWFc= +github.com/beevik/etree v1.4.0 h1:oz1UedHRepuY3p4N5OjE0nK1WLCqtzHf25bxplKOHLs= +github.com/beevik/etree v1.4.0/go.mod h1:cyWiXwGoasx60gHvtnEh5x8+uIjUVnjWqBvEnhnqKDA= github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= -github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= -github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= +github.com/cloudflare/circl v1.3.8 h1:j+V8jJt09PoeMFIu2uh5JUyEaIHTXVOHslFoLNAKqwI= +github.com/cloudflare/circl v1.3.8/go.mod h1:PDRU+oXvdD7KCtgKxW95M5Z8BpSCJXQORiZFnBQS5QU= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= 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.3 h1:in2uUcidCuFcDKtdcBxlR0rJ1+fsokWf+uqxgUFjbI0= -github.com/gabriel-vasile/mimetype v1.4.3/go.mod h1:d8uq/6HKRL6CGdk+aubisF/M5GcPfT7nKyLpA0lbSSk= +github.com/gabriel-vasile/mimetype v1.4.4 h1:QjV6pZ7/XZ7ryI2KuyeEDE8wnh7fHP9YnQy+R0LnH8I= +github.com/gabriel-vasile/mimetype v1.4.4/go.mod h1:JwLei5XPtWdGiMFB5Pjle1oEeoSeEuJfJE+TtfvdB/s= 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= @@ -27,15 +27,15 @@ github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.7.0 h1:nwc3DEeHmmLAfoZucVR881uASk0Mfjw8xYJ99tb5CcY= github.com/stretchr/testify v1.7.0/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg= -github.com/xmppo/go-xmpp v0.2.0 h1:K23zGjq0h6z9LMY2GHv3PpEaqqUDRIRPd0VeNqK0hnc= -github.com/xmppo/go-xmpp v0.2.0/go.mod h1:wR5vg1WrtcaP0DiW8XRUH9YLdFDjwlwJWl6zQEUqNuo= +github.com/xmppo/go-xmpp v0.2.1 h1:8Bw6W6RNGTq6ajgMiKxn0iJKYt6Atef5Y0A5AkGWn9Q= +github.com/xmppo/go-xmpp v0.2.1/go.mod h1:H46WSy/5uHW1SWsyJYI6fRZqFrK326qWmFRpVJ2Wwhs= github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= -golang.org/x/crypto v0.22.0 h1:g1v0xeRhjcugydODzvb3mEM9SQ0HGp9s/nh3COQ/C30= -golang.org/x/crypto v0.22.0/go.mod h1:vr6Su+7cTlO45qkww3VDJlzDn0ctJvRgYbC2NvXHt+M= +golang.org/x/crypto v0.23.0 h1:dIJU/v2J8Mdglj/8rJ6UUOM3Zc9zLZxVZwwxMooUSAI= +golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v8= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= @@ -44,8 +44,8 @@ golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= -golang.org/x/net v0.24.0 h1:1PcaxkF854Fu3+lvBIx5SYn9wRlBzzcnHZSiaFFAb0w= -golang.org/x/net v0.24.0/go.mod h1:2Q7sJY5mzlzWjKtYUEXSlBWCdyaioyXzRB2RtU8KVE8= +golang.org/x/net v0.25.0 h1:d/OCCoBEUq33pjydKrGQhw7IlUPI2Oylr+8qLx49kac= +golang.org/x/net v0.25.0/go.mod h1:JkAGAh7GEvH74S6FOH42FLoXpXbE/aqXSrIQjXgsiwM= golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= @@ -58,8 +58,8 @@ golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.19.0 h1:q5f1RH2jigJ1MoAWp2KTp3gm5zAGFUTarQZ5U386+4o= -golang.org/x/sys v0.19.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/sys v0.20.0 h1:Od9JTbYCk261bKm4M/mw7AklTlFYIa0bIp9BgSm1S8Y= +golang.org/x/sys v0.20.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= @@ -71,8 +71,8 @@ golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= -golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= -golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/text v0.15.0 h1:h1V/4gjBv8v9cjcR6+AR5+/cIYK5N/WAgiv4xlsEtAk= +golang.org/x/text v0.15.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.10.0/helpers.go new/go-sendxmpp-0.11.0/helpers.go --- old/go-sendxmpp-0.10.0/helpers.go 2024-04-13 12:17:18.000000000 +0200 +++ new/go-sendxmpp-0.11.0/helpers.go 2024-05-29 18:51:52.000000000 +0200 @@ -10,7 +10,6 @@ "crypto/cipher" "crypto/rand" "encoding/gob" - "errors" "fmt" "log" "math/big" @@ -37,7 +36,10 @@ func validURI(s string) (*url.URL, error) { // Check if URI is valid uri, err := url.ParseRequestURI(s) - return uri, fmt.Errorf("validURI: %w", err) + if err != nil { + return uri, fmt.Errorf("validURI: %w", err) + } + return uri, nil } func readFile(path string) (*bytes.Buffer, error) { @@ -45,15 +47,12 @@ if err != nil { return nil, fmt.Errorf("readFile: %w", err) } + defer file.Close() buffer := new(bytes.Buffer) _, err = buffer.ReadFrom(file) if err != nil { return nil, fmt.Errorf("readFile: %w", err) } - err = file.Close() - if err != nil { - fmt.Println("error while closing file:", err) - } return buffer, nil } @@ -197,7 +196,7 @@ return strError, fmt.Errorf("getDataPath: failed to determine user dir: %w", err) } if homeDir == "" { - return strError, errors.New("getDataPath: received empty string for home directory") + return strError, fmt.Errorf("getDataPath: received empty string for home directory") } dataDir = homeDir + "/.local/share" } @@ -243,10 +242,5 @@ } func getShortID() string { - id := make([]byte, defaultShortIDBytes) - _, err := rand.Read(id) - if err != nil { - log.Fatal(err) - } - return fmt.Sprintf("%x", id[0:4]) + return uuid.NewString()[:6] } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.10.0/httpupload.go new/go-sendxmpp-0.11.0/httpupload.go --- old/go-sendxmpp-0.10.0/httpupload.go 2024-04-13 12:17:18.000000000 +0200 +++ new/go-sendxmpp-0.11.0/httpupload.go 2024-05-29 18:51:52.000000000 +0200 @@ -7,7 +7,6 @@ import ( "bytes" "encoding/xml" - "errors" "fmt" "net/http" "net/url" @@ -68,7 +67,7 @@ } iqDiscoItemsXMLQuery = iqDiscoItemsXML.SelectElement("query") if iqDiscoItemsXMLQuery == nil { - return "", errors.New("http-upload: no query element in disco items reply") + return "", fmt.Errorf("http-upload: no query element in disco items reply") } iqDiscoItemsXMLItems := iqDiscoItemsXMLQuery.SelectElements("item") @@ -118,7 +117,7 @@ } } if uploadComponent == "" { - return "", errors.New("http-upload: no http upload component found.") + return "", fmt.Errorf("http-upload: no http upload component found.") } iqDiscoInfoXMLX := iqDiscoInfoXMLQuery.SelectElements("x") for _, r := range iqDiscoInfoXMLX { @@ -143,7 +142,7 @@ if prevFieldVal.Text() == nsHTTPUpload { maxFileSize, err = strconv.ParseInt(curFieldVal.Text(), 10, 64) if err != nil { - return "", errors.New("http-upload: error while checking server maximum http upload file size.") + return "", fmt.Errorf("http-upload: error while checking server maximum http upload file size.") } } } @@ -154,9 +153,8 @@ // the best. if maxFileSize != 0 { if fileSize > maxFileSize { - return "", errors.New("http-upload: file size " + strconv.FormatInt(fileSize/1024/1024, 10) + - " MiB is larger than the maximum file size allowed (" + - strconv.FormatInt(maxFileSize/1024/1024, 10) + " MiB).") + return "", fmt.Errorf("http-upload: file size %s MiB is larger than the maximum file size allowed (%s MiB).", + strconv.FormatInt(fileSize/1024/1024, 10), strconv.FormatInt(maxFileSize/1024/1024, 10)) } } @@ -178,7 +176,7 @@ return "", err } if uploadSlot.Type != strResult { - return "", errors.New("http-upload: error while requesting upload slot.") + return "", fmt.Errorf("http-upload: error while requesting upload slot.") } iqHTTPUploadSlotXML := etree.NewDocument() err = iqHTTPUploadSlotXML.ReadFromBytes(uploadSlot.Query) @@ -187,18 +185,18 @@ } iqHTTPUploadSlotXMLSlot := iqHTTPUploadSlotXML.SelectElement("slot") if iqHTTPUploadSlotXMLSlot == nil { - return "", errors.New("http-upload: no slot element") + return "", fmt.Errorf("http-upload: no slot element") } iqHTTPUploadSlotXMLPut := iqHTTPUploadSlotXMLSlot.SelectElement("put") if iqHTTPUploadSlotXMLPut == nil { - return "", errors.New("http-upload: no put element") + return "", fmt.Errorf("http-upload: no put element") } iqHTTPUploadSlotXMLPutURL := iqHTTPUploadSlotXMLPut.SelectAttr("url") if iqHTTPUploadSlotXMLPutURL == nil { - return "", errors.New("http-upload: no url attribute") + return "", fmt.Errorf("http-upload: no url attribute") } if !strings.HasPrefix(iqHTTPUploadSlotXMLPutURL.Value, "https://") { - return "", errors.New("http-upload: upload slot does not provide https") + return "", fmt.Errorf("http-upload: upload slot does not provide https") } // Upload file httpTransport := &http.Transport{ @@ -237,17 +235,17 @@ } // Test for http status code "200 OK" or "201 Created" if resp.StatusCode != 200 && resp.StatusCode != 201 { - return "", errors.New("http-upload: upload failed.") + return "", fmt.Errorf("http-upload: upload failed.") } // Return http link iqHTTPUploadSlotXMLGet := iqHTTPUploadSlotXMLSlot.SelectElement("get") if iqHTTPUploadSlotXMLGet == nil { - return "", errors.New("http-upload: no get element") + return "", fmt.Errorf("http-upload: no get element") } iqHTTPUploadSlotXMLGetURL := iqHTTPUploadSlotXMLGet.SelectAttr("url") if iqHTTPUploadSlotXMLGetURL == nil { - return "", errors.New("http-upload: no url attribute") + return "", fmt.Errorf("http-upload: no url attribute") } err = resp.Body.Close() if err != nil { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.10.0/jid.go new/go-sendxmpp-0.11.0/jid.go --- old/go-sendxmpp-0.10.0/jid.go 2024-04-13 12:17:18.000000000 +0200 +++ new/go-sendxmpp-0.11.0/jid.go 2024-05-29 18:51:52.000000000 +0200 @@ -8,7 +8,7 @@ package main import ( - "errors" + "fmt" "strings" "unicode/utf8" ) @@ -35,7 +35,7 @@ } else { // If the resource part exists, make sure it isn't empty. if sep == len(s)-1 { - return input, errors.New("Invalid JID" + input + ": The resourcepart must be larger than 0 bytes") + return input, fmt.Errorf("invalid JID %s: the resourcepart must be larger than 0 bytes", input) } resourcepart = s[sep+1:] s = s[:sep] @@ -52,7 +52,7 @@ domainpart = s case sep == 0: // The JID starts with an @ sign (invalid empty localpart) - err = errors.New("Invalid JID:" + input) + err = fmt.Errorf("Invalid JID: %s", input) return input, err default: domainpart = s[sep+1:] @@ -73,11 +73,11 @@ var jid string if !utf8.ValidString(localpart) || !utf8.ValidString(domainpart) || !utf8.ValidString(resourcepart) { - return input, errors.New("Invalid JID: " + input) + return input, fmt.Errorf("invalid JID: %s", input) } if domainpart == "" { - return input, errors.New("Invalid JID: " + input) + return input, fmt.Errorf("invalid JID: %s", input) } if localpart == "" { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.10.0/main.go new/go-sendxmpp-0.11.0/main.go --- old/go-sendxmpp-0.10.0/main.go 2024-04-13 12:17:18.000000000 +0200 +++ new/go-sendxmpp-0.11.0/main.go 2024-05-29 18:51:52.000000000 +0200 @@ -8,7 +8,6 @@ "bufio" "context" "crypto/tls" - "errors" "fmt" "io" "log" @@ -58,6 +57,7 @@ if err != nil { return output, fmt.Errorf("readMessage: %w", err) } + defer file.Close() scanner := bufio.NewScanner(file) scanner.Split(bufio.ScanLines) for scanner.Scan() { @@ -74,11 +74,6 @@ } } - err = file.Close() - if err != nil { - fmt.Println("error while closing file:", err) - } - return output, nil } @@ -136,6 +131,8 @@ flagHeadline := getopt.BoolLong("headline", 0, "Send message as type headline.") flagSCRAMPinning := getopt.StringLong("scram-mech-pinning", 0, "", "Enforce the use of a certain SCRAM authentication mechanism.") flagSSDPOff := getopt.BoolLong("ssdp-off", 0, "Disable XEP-0474: SASL SCRAM Downgrade Protection.") + flagSubject := getopt.StringLong("subject", 's', "", "Set message subject.") + flagFastOff := getopt.BoolLong("fast-off", 0, "Disable XEP-0484: Fast Authentication Streamlining Tokens.") // Parse command line flags. getopt.Parse() @@ -270,11 +267,13 @@ fmt.Println(err) } - fast, _ = getFastData(user, password) - // Reset FAST token and mechanism if expired. - if time.Now().After(fast.Expiry) { - fast.Token = "" - fast.Mechanism = "" + if !*flagFastOff { + fast, _ = getFastData(user, password) + // Reset FAST token and mechanism if expired. + if time.Now().After(fast.Expiry) { + fast.Token = "" + fast.Mechanism = "" + } } // Use ALPN @@ -320,6 +319,7 @@ SSDP: !*flagSSDPOff, UserAgentSW: resource, UserAgentID: clientID, + Fast: !*flagFastOff, FastToken: fast.Token, FastMechanism: fast.Mechanism, } @@ -563,7 +563,7 @@ default: if err != nil { cancel() - closeAndExit(client, errors.New("failed to read from stdin")) + closeAndExit(client, fmt.Errorf("failed to read from stdin")) } } } @@ -581,7 +581,7 @@ continue } oxMessage, err := oxEncrypt(client, oxPrivKey, - recipient.Jid, recipient.OxKeyRing, message) + recipient.Jid, recipient.OxKeyRing, message, *flagSubject) if err != nil { fmt.Println("Ox: couldn't encrypt to", recipient.Jid) @@ -596,6 +596,7 @@ _, err = client.Send(xmpp.Chat{ Remote: recipient.Jid, Type: msgType, Text: message, + Subject: *flagSubject, }) if err != nil { cancel() @@ -692,6 +693,7 @@ _, err = client.Send(xmpp.Chat{ Remote: recipient.Jid, Type: msgType, Ooburl: message, Text: message, + Subject: *flagSubject, }) if err != nil { fmt.Println("Couldn't send message to", @@ -700,9 +702,15 @@ // (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 != "": - _, err = client.SendOrg("<message to='" + recipient.Jid + "' type='" + - msgType + "'><body>" + message + "</body><x xmlns='jabber:x:oob'><url>" + - message + "</url></x></message>") + 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) + } 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) + } + _, err = client.SendOrg(msg) if err != nil { fmt.Println("Couldn't send message to", recipient.Jid) @@ -712,7 +720,7 @@ continue } oxMessage, err := oxEncrypt(client, oxPrivKey, - recipient.Jid, recipient.OxKeyRing, message) + recipient.Jid, recipient.OxKeyRing, message, *flagSubject) if err != nil { fmt.Println("Ox: couldn't encrypt to", recipient.Jid) continue @@ -726,6 +734,7 @@ _, err = client.Send(xmpp.Chat{ Remote: recipient.Jid, Type: msgType, Text: message, + Subject: *flagSubject, }) if err != nil { cancel() diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.10.0/man/go-sendxmpp.1 new/go-sendxmpp-0.11.0/man/go-sendxmpp.1 --- old/go-sendxmpp-0.10.0/man/go-sendxmpp.1 2024-04-13 12:17:18.000000000 +0200 +++ new/go-sendxmpp-0.11.0/man/go-sendxmpp.1 2024-05-29 18:51:52.000000000 +0200 @@ -1,10 +1,10 @@ .\" generated with Ronn-NG/v0.9.1 .\" http://github.com/apjanke/ronn-ng/tree/0.9.1 -.TH "GO\-SENDXMPP" "1" "April 2024" "" +.TH "GO\-SENDXMPP" "1" "May 2024" "" .SH "NAME" \fBgo\-sendxmpp\fR \- A tool to send messages to an XMPP contact or MUC\. .SH "SYNOPSIS" -\fBgo\-sendxmpp [\-cdilnt] [\-a value] [\-f value] [\-\-headline] [\-\-help] [\-h value] [\-j value] [\-m value] [\-\-muc\-password value] [\-\-oob\-file value] [\-\-ox] [\-\-ox\-delete\-nodes] [\-\-ox\-genprivkey\-rsa] [\-\-ox\-genprivkey\-x25519] [\-\-ox\-import\-privkey value] [\-\-ox\-passphrase value] [\-p value] [\-\-raw] [\-\-scram\-mech\-pinning value] [\-\-ssdp\-off] [\-\-timeout value] [\-\-tls\-version value] [\-u value] [\-\-version] [recipients…]\fR +\fBgo\-sendxmpp [\-cdilnt] [\-a value] [\-\-fast\-off] [\-f value] [\-\-headline] [\-\-help] [\-h value] [\-j value] [\-m value] [\-\-muc\-password value] [\-\-oob\-file value] [\-\-ox] [\-\-ox\-delete\-nodes] [\-\-ox\-genprivkey\-rsa] [\-\-ox\-genprivkey\-x25519] [\-\-ox\-import\-privkey value] [\-\-ox\-passphrase value] [\-p value] [\-\-raw] [\-\-scram\-mech\-pinning value] [\-\-ssdp\-off] [\-s value] [\-\-timeout value] [\-\-tls\-version value] [\-u value] [\-\-version] [recipients…]\fR .SH "DESCRIPTION" A tool to send messages to an XMPP contact or MUC inspired by \fBsendxmpp\fR\. .br @@ -20,6 +20,9 @@ \fB\-d\fR, \fB\-\-debug\fR Show debugging info\. .TP +\fB\-\-fast\-off\fR +Disable XEP\-0484: Fast Authentication Streamlining Tokens\. +.TP \fB\-f\fR, \fB\-\-file\fR=[\fIvalue\fR] Set configuration file\. (Default: ~/\.config/go\-sendxmpp/config) .TP @@ -92,6 +95,9 @@ \fB\-\-ssdp\-off\fR Disable XEP\-0474: SASL SCRAM Downgrade Protection\. .TP +\fB\-s\fR, \fB\-\-subject\fR=[\fIvalue\fR] +Set message subject\. +.TP \fB\-\-timeout=\fR[\fIvalue\fR] Connection timeout in seconds\. (Default: 10) .TP diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.10.0/man/go-sendxmpp.1.html new/go-sendxmpp-0.11.0/man/go-sendxmpp.1.html --- old/go-sendxmpp-0.10.0/man/go-sendxmpp.1.html 2024-04-13 12:17:18.000000000 +0200 +++ new/go-sendxmpp-0.11.0/man/go-sendxmpp.1.html 2024-05-29 18:51:52.000000000 +0200 @@ -81,10 +81,10 @@ </p> <h2 id="SYNOPSIS">SYNOPSIS</h2> -<p><code>go-sendxmpp [-cdilnt] [-a value] [-f value] [--headline] [--help] [-h value] [-j value] [-m value] [--muc-password value] +<p><code>go-sendxmpp [-cdilnt] [-a value] [--fast-off] [-f value] [--headline] [--help] [-h value] [-j value] [-m value] [--muc-password value] [--oob-file value] [--ox] [--ox-delete-nodes] [--ox-genprivkey-rsa] [--ox-genprivkey-x25519] [--ox-import-privkey value] -[--ox-passphrase value] [-p value] [--raw] [--scram-mech-pinning value] [--ssdp-off] [--timeout value] [--tls-version value] [-u value] -[--version] [recipients…]</code></p> +[--ox-passphrase value] [-p value] [--raw] [--scram-mech-pinning value] [--ssdp-off] [-s value] [--timeout value] +[--tls-version value] [-u value] [--version] [recipients…]</code></p> <h2 id="DESCRIPTION">DESCRIPTION</h2> @@ -108,6 +108,8 @@ <code>-d</code>, <code>--debug</code> </dt> <dd>Show debugging info.</dd> +<dt><code>--fast-off</code></dt> +<dd>Disable XEP-0484: Fast Authentication Streamlining Tokens.</dd> <dt> <code>-f</code>, <code>--file</code>=[<var>value</var>]</dt> <dd>Set configuration file. (Default: ~/.config/go-sendxmpp/config)</dd> @@ -195,6 +197,9 @@ <dt><code>--ssdp-off</code></dt> <dd>Disable XEP-0474: SASL SCRAM Downgrade Protection.</dd> <dt> +<code>-s</code>, <code>--subject</code>=[<var>value</var>]</dt> +<dd>Set message subject.</dd> +<dt> <code>--timeout=</code>[<var>value</var>]</dt> <dd>Connection timeout in seconds. (Default: 10)</dd> <dt> @@ -279,7 +284,7 @@ <ol class='man-decor man-foot man foot'> <li class='tl'></li> - <li class='tc'>April 2024</li> + <li class='tc'>May 2024</li> <li class='tr'>go-sendxmpp(1)</li> </ol> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.10.0/man/go-sendxmpp.1.ronn new/go-sendxmpp-0.11.0/man/go-sendxmpp.1.ronn --- old/go-sendxmpp-0.10.0/man/go-sendxmpp.1.ronn 2024-04-13 12:17:18.000000000 +0200 +++ new/go-sendxmpp-0.11.0/man/go-sendxmpp.1.ronn 2024-05-29 18:51:52.000000000 +0200 @@ -3,10 +3,10 @@ ## SYNOPSIS -`go-sendxmpp [-cdilnt] [-a value] [-f value] [--headline] [--help] [-h value] [-j value] [-m value] [--muc-password value] +`go-sendxmpp [-cdilnt] [-a value] [--fast-off] [-f value] [--headline] [--help] [-h value] [-j value] [-m value] [--muc-password value] [--oob-file value] [--ox] [--ox-delete-nodes] [--ox-genprivkey-rsa] [--ox-genprivkey-x25519] [--ox-import-privkey value] -[--ox-passphrase value] [-p value] [--raw] [--scram-mech-pinning value] [--ssdp-off] [--timeout value] [--tls-version value] [-u value] -[--version] [recipients…]` +[--ox-passphrase value] [-p value] [--raw] [--scram-mech-pinning value] [--ssdp-off] [-s value] [--timeout value] +[--tls-version value] [-u value] [--version] [recipients…]` ## DESCRIPTION @@ -28,6 +28,9 @@ * `-d`, `--debug`: Show debugging info. +* `--fast-off`: +Disable XEP-0484: Fast Authentication Streamlining Tokens. + * `-f`, `--file`=[<value>]: Set configuration file. (Default: ~/.config/go-sendxmpp/config) @@ -120,6 +123,9 @@ * `--ssdp-off`: Disable XEP-0474: SASL SCRAM Downgrade Protection. +* `-s`, `--subject`=[<value>]: +Set message subject. + * `--timeout=`[<value>]: Connection timeout in seconds. (Default: 10) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.10.0/ox.go new/go-sendxmpp-0.11.0/ox.go --- old/go-sendxmpp-0.10.0/ox.go 2024-04-13 12:17:18.000000000 +0200 +++ new/go-sendxmpp-0.11.0/ox.go 2024-05-29 18:51:52.000000000 +0200 @@ -6,7 +6,6 @@ import ( "encoding/base64" - "errors" "fmt" "log" "os" @@ -39,11 +38,11 @@ } query = nodeListReply.SelectElement("query") if query == nil { - return errors.New("error parsing iq reply") + return fmt.Errorf("error parsing iq reply") } items := query.SelectElements("item") if items == nil { - return errors.New("error parsing iq reply") + return fmt.Errorf("error parsing iq reply") } for _, item := range items { node := item.SelectAttr("node") @@ -106,26 +105,26 @@ } signcrypt := doc.SelectElement("signcrypt") if signcrypt == nil { - return strError, time.Now(), errors.New("ox: no signcrypt element") + return strError, time.Now(), fmt.Errorf("ox: no signcrypt element") } to := signcrypt.SelectElement("to") if to == nil { - return strError, time.Now(), errors.New("ox: no to element") + return strError, time.Now(), fmt.Errorf("ox: no to element") } jid := to.SelectAttr("jid") if jid == nil { - return strError, time.Now(), errors.New("ox: no jid attribute") + return strError, time.Now(), fmt.Errorf("ox: no jid attribute") } if strings.Split(jid.Value, "/")[0] != user { - return strError, time.Now(), errors.New("ox: encrypted for wrong user") + return strError, time.Now(), fmt.Errorf("ox: encrypted for wrong user") } timestamp := signcrypt.SelectElement("time") if timestamp == nil { - return strError, time.Now(), errors.New("ox: no time element") + return strError, time.Now(), fmt.Errorf("ox: no time element") } stamp := timestamp.SelectAttr("stamp") if stamp == nil { - return strError, time.Now(), errors.New("ox: no stamp attribute") + return strError, time.Now(), fmt.Errorf("ox: no stamp attribute") } msgStamp, err := time.Parse("2006-01-02T15:04:05Z0700", stamp.Value) if err != nil { @@ -133,7 +132,7 @@ } payload := signcrypt.SelectElement("payload") if payload == nil { - return strError, time.Now(), errors.New("ox: no payload element") + return strError, time.Now(), fmt.Errorf("ox: no payload element") } body := payload.SelectElement("body") if body == nil { @@ -173,7 +172,7 @@ } entity := key.GetEntity() if entity.Identities[xmppURI] == nil { - return errors.New("Key identity is not " + xmppURI) + return fmt.Errorf("Key identity is not %s", xmppURI) } pk, err := key.GetPublicKey() if err != nil { @@ -262,19 +261,19 @@ return fmt.Errorf("oxPublishPubKey: iq failure publishing public key: %w", err) } if iqReply.Type != strResult { - return errors.New("error while publishing public key") + return fmt.Errorf("error while publishing public key") } ownPubKeyRingFromPubsub, err := oxRecvPublicKeys(client, iqc, jid, fingerprint) if err != nil { - return errors.New("couldn't successfully verify public key upload") + return fmt.Errorf("couldn't successfully verify public key upload") } ownPubKeyFromPubsub := ownPubKeyRingFromPubsub.GetKeys()[0] ownPubKeyFromPubsubSerialized, err := ownPubKeyFromPubsub.Serialize() if err != nil { - return errors.New("couldn't successfully verify public key upload") + return fmt.Errorf("couldn't successfully verify public key upload") } if pubKeyBase64 != base64.StdEncoding.EncodeToString(ownPubKeyFromPubsubSerialized) { - return errors.New("couldn't successfully verify public key upload") + return fmt.Errorf("couldn't successfully verify public key upload") } root = etree.NewDocument() root.WriteSettings.AttrSingleQuote = true @@ -310,21 +309,26 @@ return fmt.Errorf("oxPublishPubKey: iq failure publishing public key list: %w", err) } if iqReply.Type != strResult { - return errors.New("couldn't publish public key list") + return fmt.Errorf("couldn't publish public key list") } return nil } func oxGetPrivKeyLoc(jid string) (string, error) { - dataDir, err := getDataPath("oxprivkeys/") + dataDir, err := getDataPath(strings.Replace(strings.Replace(jid, "@", "_at_", -1), ".", "_", -1)) if err != nil { - return strError, fmt.Errorf("oxGetPubKeyLoc: %w", err) + return strError, fmt.Errorf("oxGetPrivKeyLoc: %w", err) + } + oldDataDir, err := getDataPath("oxprivkeys/") + if err != nil { + return strError, fmt.Errorf("oxGetPrivKeyLoc: %w", err) } // TODO: Remove handling of oldDataFile in a later version when it's very likely that there are no // more versions in use using the oldDataFile (<0.8.3). - oldDataFile := dataDir + base64.StdEncoding.EncodeToString([]byte(jid)) - oldDataFile2 := dataDir + strings.Replace(jid, "@", "_at_", -1) - dataFile := dataDir + strings.Replace(strings.Replace(jid, "@", "_at_", -1), ".", "_", -1) + oldDataFile := oldDataDir + base64.StdEncoding.EncodeToString([]byte(jid)) + oldDataFile2 := oldDataDir + strings.Replace(jid, "@", "_at_", -1) + oldDataFile3 := oldDataDir + strings.Replace(strings.Replace(jid, "@", "_at_", -1), ".", "_", -1) + dataFile := dataDir + "oxprivkey" if _, err := os.Stat(oldDataFile); err == nil { err := os.Rename(oldDataFile, dataFile) if err != nil { @@ -337,6 +341,12 @@ return dataFile, err } } + if _, err := os.Stat(oldDataFile3); err == nil { + err := os.Rename(oldDataFile3, dataFile) + if err != nil { + return dataFile, err + } + } return dataFile, nil } @@ -381,7 +391,7 @@ log.Fatal("Ox: private key is locked.") } if key.IsExpired() { - return nil, errors.New("Ox: private key is expired: " + key.GetFingerprint()) + return nil, fmt.Errorf("Ox: private key is expired: %s", key.GetFingerprint()) } return key, nil } @@ -467,7 +477,7 @@ return nil, fmt.Errorf("oxRecvPublicKeys: iq error requesting public keys: %w", err) } if oxPublicKey.Type != strResult { - return nil, errors.New("error while requesting public key for " + + return nil, fmt.Errorf("error while requesting public key for %s", recipient) } oxPublicKeyXML := etree.NewDocument() @@ -481,18 +491,15 @@ } oxPublicKeyXMLPubsub := oxPublicKeyXML.SelectElement("pubsub") if oxPublicKeyXMLPubsub == nil { - return nil, errors.New("ox: no pubsub element in reply to public " + - "key request") + return nil, fmt.Errorf("ox: no pubsub element in reply to public key request") } oxPublicKeyXMLItems := oxPublicKeyXMLPubsub.SelectElement("items") if oxPublicKeyXMLItems == nil { - return nil, errors.New("ox: no items element in reply to public " + - "key request") + return nil, fmt.Errorf("ox: no items element in reply to public key request") } oxPublicKeyXMLItem := oxPublicKeyXMLItems.SelectElement("item") if oxPublicKeyXMLItem == nil { - return nil, errors.New("ox: no item element in reply to public " + - "key request") + return nil, fmt.Errorf("ox: no item element in reply to public key request") } oxPublicKeyXMLPubkeys := oxPublicKeyXMLItem.SelectElements("pubkey") for _, r := range oxPublicKeyXMLPubkeys { @@ -509,7 +516,7 @@ return nil, fmt.Errorf("oxRecvPublicKeys: failed to decode public key: %w", err) } if key.IsExpired() { - return nil, errors.New("Key is expired: " + fingerprint) + return nil, fmt.Errorf("Key is expired: %s", fingerprint) } err = keyring.AddKey(key) if err != nil { @@ -541,7 +548,7 @@ log.Fatal(err) } if oxPublicKeyList.Type != strResult { - return nil, errors.New("error while requesting public openpgp keys for " + + return nil, fmt.Errorf("error while requesting public openpgp keys for %s", recipient) } oxPubKeyListXML := etree.NewDocument() @@ -558,19 +565,19 @@ oxPubKeyListXMLPubsub := oxPubKeyListXML.SelectElement("pubsub") if oxPubKeyListXMLPubsub == nil { - return nil, errors.New("ox: no pubsub element in public key list") + return nil, fmt.Errorf("ox: no pubsub element in public key list") } oxPubKeyListXMLPubsubItems := oxPubKeyListXMLPubsub.SelectElement("items") if oxPubKeyListXMLPubsubItems == nil { - return nil, errors.New("ox: no items element in public key list") + return nil, fmt.Errorf("ox: no items element in public key list") } oxPubKeyListXMLPubsubItemsItem := oxPubKeyListXMLPubsubItems.SelectElement("item") if oxPubKeyListXMLPubsubItemsItem == nil { - return nil, errors.New("ox: no item element in public key list") + return nil, fmt.Errorf("ox: no item element in public key list") } oxPubKeyListXMLPubsubItemsItemPkl := oxPubKeyListXMLPubsubItemsItem.SelectElement("public-keys-list") if oxPubKeyListXMLPubsubItemsItemPkl == nil { - return nil, errors.New("ox: no public-keys-list element") + return nil, fmt.Errorf("ox: no public-keys-list element") } oxPubKeyListXMLPubsubItemsItemPklPm := oxPubKeyListXMLPubsubItemsItemPkl.SelectElements("pubkey-metadata") for _, r := range oxPubKeyListXMLPubsubItemsItemPklPm { @@ -592,7 +599,7 @@ } } if pubKeyRingID == "none" { - return nil, errors.New("server didn't provide public key fingerprints for " + recipient) + return nil, fmt.Errorf("server didn't provide public key fingerprints for %s", recipient) } pubKeyRingLocation, err := oxGetPubKeyLoc(pubKeyRingID) @@ -612,7 +619,7 @@ if !savedKeysDate.Before(newestKey) { pubKeys := pubKeyReadXML.SelectElements("pubkey") if pubKeys == nil { - return nil, errors.New("couldn't read public keys from cache") + return nil, fmt.Errorf("couldn't read public keys from cache") } for _, r := range pubKeys { keyByte, err := base64.StdEncoding.DecodeString(r.Text()) @@ -658,7 +665,7 @@ return pubKeyRing, nil } -func oxEncrypt(client *xmpp.Client, oxPrivKey *crypto.Key, recipient string, keyRing *crypto.KeyRing, message string) (string, error) { +func oxEncrypt(client *xmpp.Client, oxPrivKey *crypto.Key, recipient string, keyRing *crypto.KeyRing, message string, subject string) (string, error) { if message == "" { return "", nil } @@ -685,6 +692,10 @@ oxCryptMessageScRpad := oxCryptMessageSc.CreateElement("rpad") oxCryptMessageScRpad.CreateText(getRpad(len(message))) oxCryptMessageScPayload := oxCryptMessageSc.CreateElement("payload") + if subject != "" { + oxCryptMessageScPayloadSub := oxCryptMessageScPayload.CreateElement("subject") + oxCryptMessageScPayloadSub.CreateText(subject) + } oxCryptMessageScPayloadBody := oxCryptMessageScPayload.CreateElement("body") oxCryptMessageScPayloadBody.CreateAttr("xmlns", nsJabberClient) oxCryptMessageScPayloadBody.CreateText(message) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.10.0/parseconfig.go new/go-sendxmpp-0.11.0/parseconfig.go --- old/go-sendxmpp-0.10.0/parseconfig.go 2024-04-13 12:17:18.000000000 +0200 +++ new/go-sendxmpp-0.11.0/parseconfig.go 2024-05-29 18:51:52.000000000 +0200 @@ -6,7 +6,6 @@ import ( "bufio" - "errors" "fmt" "log" "os" @@ -26,7 +25,7 @@ // Get home directory. home := curUser.HomeDir if home == "" { - return "", errors.New("no home directory found") + return "", fmt.Errorf("findConfig: no home directory found") } osConfigDir := os.Getenv("$XDG_CONFIG_HOME") if osConfigDir == "" { @@ -45,7 +44,7 @@ return r, nil } } - return "", errors.New("no configuration file found") + return "", fmt.Errorf("findConfig: no configuration file found") } // Opens the config file and returns the specified values @@ -77,8 +76,7 @@ perm := info.Mode().Perm() permissions := strconv.FormatInt(int64(perm), 8) if permissions != "600" && permissions != "640" && permissions != "440" && permissions != "400" { - return output, errors.New("Wrong permissions for " + configPath + ": " + - permissions + " instead of 400, 440, 600 or 640.") + return output, fmt.Errorf("parseConfig: wrong permissions for %s: %s instead of 400, 440, 600 or 640.", configPath, permissions) } } @@ -87,6 +85,7 @@ if err != nil { return output, fmt.Errorf("parseConfig: failed to open config file: %w", err) } + defer file.Close() scanner := bufio.NewScanner(file) scanner.Split(bufio.ScanLines) @@ -140,10 +139,6 @@ } } } - err = file.Close() - if err != nil { - fmt.Println("error closing file:", err) - } // Check if the username is a valid JID output.username, err = MarshalJID(output.username) @@ -154,7 +149,7 @@ // Check if the username is a valid JID now output.username, err = MarshalJID(output.username) if err != nil { - return output, errors.New("invalid username/JID: " + output.username) + return output, fmt.Errorf("parseConfig: invalid username/JID: %s", output.username) } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/go-sendxmpp-0.10.0/stanzahandling.go new/go-sendxmpp-0.11.0/stanzahandling.go --- old/go-sendxmpp-0.10.0/stanzahandling.go 2024-04-13 12:17:18.000000000 +0200 +++ new/go-sendxmpp-0.11.0/stanzahandling.go 2024-05-29 18:51:52.000000000 +0200 @@ -6,7 +6,6 @@ import ( "context" - "errors" "fmt" "io" "log" @@ -30,7 +29,7 @@ select { case iq = <-c: case <-time.After(60 * time.Second): - return iq, errors.New("sendIQ: server didn't reply to IQ: " + content) + return iq, fmt.Errorf("sendIQ: server didn't reply to IQ: %s", content) } return iq, nil } ++++++ vendor.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/beevik/etree/CONTRIBUTORS new/vendor/github.com/beevik/etree/CONTRIBUTORS --- old/vendor/github.com/beevik/etree/CONTRIBUTORS 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/github.com/beevik/etree/CONTRIBUTORS 2024-05-31 06:53:06.000000000 +0200 @@ -11,3 +11,4 @@ Martin Dosch (mdosch) Hugo Wetterberg (hugowetterberg) Tobias Theel (nerzal) +Daniel Potapov (dpotapov) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/beevik/etree/LICENSE new/vendor/github.com/beevik/etree/LICENSE --- old/vendor/github.com/beevik/etree/LICENSE 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/github.com/beevik/etree/LICENSE 2024-05-31 06:53:06.000000000 +0200 @@ -1,4 +1,4 @@ -Copyright 2015-2023 Brett Vickers. All rights reserved. +Copyright 2015-2024 Brett Vickers. All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/beevik/etree/RELEASE_NOTES.md new/vendor/github.com/beevik/etree/RELEASE_NOTES.md --- old/vendor/github.com/beevik/etree/RELEASE_NOTES.md 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/github.com/beevik/etree/RELEASE_NOTES.md 2024-05-31 06:53:06.000000000 +0200 @@ -1,3 +1,13 @@ +Release v1.4.0 +============== + +**New Features** + +* Add `AutoClose` option to `ReadSettings`. +* Add `ValidateInput` to `ReadSettings`. +* Add `NotNil` function to `Element`. +* Add `NextSibling` and `PrevSibling` functions to `Element`. + Release v1.3.0 ============== diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/beevik/etree/etree.go new/vendor/github.com/beevik/etree/etree.go --- old/vendor/github.com/beevik/etree/etree.go 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/github.com/beevik/etree/etree.go 2024-05-31 06:53:06.000000000 +0200 @@ -50,8 +50,21 @@ // preserve them instead of keeping only one. Default: false. PreserveDuplicateAttrs bool + // ValidateInput forces all ReadFrom* methods to validate that the + // provided input is composed of well-formed XML before processing it. If + // invalid XML is detected, the ReadFrom* methods return an error. Because + // this option requires the input to be processed twice, it incurs a + // significant performance penalty. Default: false. + ValidateInput bool + // Entity to be passed to standard xml.Decoder. Default: nil. Entity map[string]string + + // When Permissive is true, AutoClose indicates a set of elements to + // consider closed immediately after they are opened, regardless of + // whether an end element is present. Commonly set to xml.HTMLAutoClose. + // Default: nil. + AutoClose []string } // newReadSettings creates a default ReadSettings record. @@ -60,9 +73,6 @@ CharsetReader: func(label string, input io.Reader) (io.Reader, error) { return input, nil }, - Permissive: false, - PreserveCData: false, - Entity: nil, } } @@ -347,6 +357,16 @@ // ReadFrom reads XML from the reader 'r' into this document. The function // returns the number of bytes read and any error encountered. func (d *Document) ReadFrom(r io.Reader) (n int64, err error) { + if d.ReadSettings.ValidateInput { + b, err := io.ReadAll(r) + if err != nil { + return 0, err + } + if err := validateXML(bytes.NewReader(b), d.ReadSettings); err != nil { + return 0, err + } + r = bytes.NewReader(b) + } return d.Element.readFrom(r, d.ReadSettings) } @@ -358,22 +378,62 @@ return err } defer f.Close() + _, err = d.ReadFrom(f) return err } // ReadFromBytes reads XML from the byte slice 'b' into the this document. func (d *Document) ReadFromBytes(b []byte) error { - _, err := d.ReadFrom(bytes.NewReader(b)) + if d.ReadSettings.ValidateInput { + if err := validateXML(bytes.NewReader(b), d.ReadSettings); err != nil { + return err + } + } + _, err := d.Element.readFrom(bytes.NewReader(b), d.ReadSettings) return err } // ReadFromString reads XML from the string 's' into this document. func (d *Document) ReadFromString(s string) error { - _, err := d.ReadFrom(strings.NewReader(s)) + if d.ReadSettings.ValidateInput { + if err := validateXML(strings.NewReader(s), d.ReadSettings); err != nil { + return err + } + } + _, err := d.Element.readFrom(strings.NewReader(s), d.ReadSettings) return err } +// validateXML determines if the data read from the reader 'r' contains +// well-formed XML according to the rules set by the go xml package. +func validateXML(r io.Reader, settings ReadSettings) error { + dec := newDecoder(r, settings) + err := dec.Decode(new(interface{})) + if err != nil { + return err + } + + // If there are any trailing tokens after unmarshalling with Decode(), + // then the XML input didn't terminate properly. + _, err = dec.Token() + if err == io.EOF { + return nil + } + return ErrXML +} + +// newDecoder creates an XML decoder for the reader 'r' configured using +// the provided read settings. +func newDecoder(r io.Reader, settings ReadSettings) *xml.Decoder { + d := xml.NewDecoder(r) + d.CharsetReader = settings.CharsetReader + d.Strict = !settings.Permissive + d.Entity = settings.Entity + d.AutoClose = settings.AutoClose + return d +} + // WriteTo serializes the document out to the writer 'w'. The function returns // the number of bytes written and any error encountered. func (d *Document) WriteTo(w io.Writer) (n int64, err error) { @@ -796,6 +856,27 @@ return t } +// autoClose analyzes the stack's top element and the current token to decide +// whether the top element should be closed. +func (e *Element) autoClose(stack *stack, t xml.Token, tags []string) { + if stack.empty() { + return + } + + top := stack.peek().(*Element) + + for _, tag := range tags { + if strings.EqualFold(tag, top.FullTag()) { + if e, ok := t.(xml.EndElement); !ok || + !strings.EqualFold(e.Name.Space, top.Space) || + !strings.EqualFold(e.Name.Local, top.Tag) { + stack.pop() + } + break + } + } +} + // ReadFrom reads XML from the reader 'ri' and stores the result as a new // child of this element. func (e *Element) readFrom(ri io.Reader, settings ReadSettings) (n int64, err error) { @@ -808,10 +889,7 @@ r = newXmlSimpleReader(ri) } - dec := xml.NewDecoder(r) - dec.CharsetReader = settings.CharsetReader - dec.Strict = !settings.Permissive - dec.Entity = settings.Entity + dec := newDecoder(r, settings) var stack stack stack.push(e) @@ -822,6 +900,10 @@ t, err := dec.RawToken() + if settings.Permissive && settings.AutoClose != nil { + e.autoClose(&stack, t, settings.AutoClose) + } + switch { case err == io.EOF: if len(stack.data) != 1 { @@ -970,6 +1052,25 @@ return p.traverse(e, path) } +// NotNil returns the receiver element if it isn't nil; otherwise, it returns +// an unparented element with an empty string tag. This function simplifies +// the task of writing code to ignore not-found results from element queries. +// For example, instead of writing this: +// +// if e := doc.SelectElement("enabled"); e != nil { +// e.SetText("true") +// } +// +// You could write this: +// +// doc.SelectElement("enabled").NotNil().SetText("true") +func (e *Element) NotNil() *Element { + if e == nil { + return NewElement("") + } + return e +} + // GetPath returns the absolute path of the element. The absolute path is the // full path from the document's root. func (e *Element) GetPath() string { @@ -1173,6 +1274,34 @@ return ne } +// NextSibling returns this element's next sibling element. It returns nil if +// there is no next sibling element. +func (e *Element) NextSibling() *Element { + if e.parent == nil { + return nil + } + for i := e.index + 1; i < len(e.parent.Child); i++ { + if s, ok := e.parent.Child[i].(*Element); ok { + return s + } + } + return nil +} + +// PrevSibling returns this element's preceding sibling element. It returns +// nil if there is no preceding sibling element. +func (e *Element) PrevSibling() *Element { + if e.parent == nil { + return nil + } + for i := e.index - 1; i >= 0; i-- { + if s, ok := e.parent.Child[i].(*Element); ok { + return s + } + } + return nil +} + // Parent returns this element's parent element. It returns nil if this // element has no parent. func (e *Element) Parent() *Element { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/cloudflare/circl/dh/x25519/curve_amd64.s new/vendor/github.com/cloudflare/circl/dh/x25519/curve_amd64.s --- old/vendor/github.com/cloudflare/circl/dh/x25519/curve_amd64.s 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/github.com/cloudflare/circl/dh/x25519/curve_amd64.s 2024-05-31 06:53:06.000000000 +0200 @@ -1,4 +1,5 @@ -// +build amd64 +//go:build amd64 && !purego +// +build amd64,!purego #include "textflag.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/cloudflare/circl/dh/x448/curve_amd64.s new/vendor/github.com/cloudflare/circl/dh/x448/curve_amd64.s --- old/vendor/github.com/cloudflare/circl/dh/x448/curve_amd64.s 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/github.com/cloudflare/circl/dh/x448/curve_amd64.s 2024-05-31 06:53:06.000000000 +0200 @@ -1,4 +1,5 @@ -// +build amd64 +//go:build amd64 && !purego +// +build amd64,!purego #include "textflag.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/cloudflare/circl/math/fp25519/fp_amd64.s new/vendor/github.com/cloudflare/circl/math/fp25519/fp_amd64.s --- old/vendor/github.com/cloudflare/circl/math/fp25519/fp_amd64.s 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/github.com/cloudflare/circl/math/fp25519/fp_amd64.s 2024-05-31 06:53:06.000000000 +0200 @@ -1,4 +1,5 @@ -// +build amd64 +//go:build amd64 && !purego +// +build amd64,!purego #include "textflag.h" #include "fp_amd64.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/cloudflare/circl/math/fp448/fp_amd64.s new/vendor/github.com/cloudflare/circl/math/fp448/fp_amd64.s --- old/vendor/github.com/cloudflare/circl/math/fp448/fp_amd64.s 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/github.com/cloudflare/circl/math/fp448/fp_amd64.s 2024-05-31 06:53:06.000000000 +0200 @@ -1,4 +1,5 @@ -// +build amd64 +//go:build amd64 && !purego +// +build amd64,!purego #include "textflag.h" #include "fp_amd64.h" diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/gabriel-vasile/mimetype/LICENSE new/vendor/github.com/gabriel-vasile/mimetype/LICENSE --- old/vendor/github.com/gabriel-vasile/mimetype/LICENSE 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/github.com/gabriel-vasile/mimetype/LICENSE 2024-05-31 06:53:06.000000000 +0200 @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2018-2020 Gabriel Vasile +Copyright (c) 2018 Gabriel Vasile Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/gabriel-vasile/mimetype/README.md new/vendor/github.com/gabriel-vasile/mimetype/README.md --- old/vendor/github.com/gabriel-vasile/mimetype/README.md 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/github.com/gabriel-vasile/mimetype/README.md 2024-05-31 06:53:06.000000000 +0200 @@ -16,9 +16,6 @@ <a href="https://goreportcard.com/report/github.com/gabriel-vasile/mimetype"> <img alt="Go report card" src="https://goreportcard.com/badge/github.com/gabriel-vasile/mimetype"> </a> - <a href="https://codecov.io/gh/gabriel-vasile/mimetype"> - <img alt="Code coverage" src="https://codecov.io/gh/gabriel-vasile/mimetype/branch/master/graph/badge.svg?token=qcfJF1kkl2"/> - </a> <a href="LICENSE"> <img alt="License" src="https://img.shields.io/badge/License-MIT-green.svg"> </a> diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/gabriel-vasile/mimetype/internal/magic/archive.go new/vendor/github.com/gabriel-vasile/mimetype/internal/magic/archive.go --- old/vendor/github.com/gabriel-vasile/mimetype/internal/magic/archive.go 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/github.com/gabriel-vasile/mimetype/internal/magic/archive.go 2024-05-31 06:53:06.000000000 +0200 @@ -3,6 +3,7 @@ import ( "bytes" "encoding/binary" + "strconv" ) var ( @@ -74,51 +75,87 @@ } // Tar matches a (t)ape (ar)chive file. +// Tar files are divided into 512 bytes records. First record contains a 257 +// bytes header padded with NUL. func Tar(raw []byte, _ uint32) bool { - // The "magic" header field for files in in UStar (POSIX IEEE P1003.1) archives - // has the prefix "ustar". The values of the remaining bytes in this field vary - // by archiver implementation. - if len(raw) >= 512 && bytes.HasPrefix(raw[257:], []byte{0x75, 0x73, 0x74, 0x61, 0x72}) { - return true + const sizeRecord = 512 + + // The structure of a tar header: + // type TarHeader struct { + // Name [100]byte + // Mode [8]byte + // Uid [8]byte + // Gid [8]byte + // Size [12]byte + // Mtime [12]byte + // Chksum [8]byte + // Linkflag byte + // Linkname [100]byte + // Magic [8]byte + // Uname [32]byte + // Gname [32]byte + // Devmajor [8]byte + // Devminor [8]byte + // } + + if len(raw) < sizeRecord { + return false } + raw = raw[:sizeRecord] - if len(raw) < 256 { + // First 100 bytes of the header represent the file name. + // Check if file looks like Gentoo GLEP binary package. + if bytes.Contains(raw[:100], []byte("/gpkg-1\x00")) { return false } - // The older v7 format has no "magic" field, and therefore must be identified - // with heuristics based on legal ranges of values for other header fields: - // https://www.nationalarchives.gov.uk/PRONOM/Format/proFormatSearch.aspx?status=detailReport&id=385&strPageToDisplay=signatures - rules := []struct { - min, max uint8 - i int - }{ - {0x21, 0xEF, 0}, - {0x30, 0x37, 105}, - {0x20, 0x37, 106}, - {0x00, 0x00, 107}, - {0x30, 0x37, 113}, - {0x20, 0x37, 114}, - {0x00, 0x00, 115}, - {0x30, 0x37, 121}, - {0x20, 0x37, 122}, - {0x00, 0x00, 123}, - {0x30, 0x37, 134}, - {0x30, 0x37, 146}, - {0x30, 0x37, 153}, - {0x00, 0x37, 154}, - } - for _, r := range rules { - if raw[r.i] < r.min || raw[r.i] > r.max { - return false - } + // Get the checksum recorded into the file. + recsum, err := tarParseOctal(raw[148:156]) + if err != nil { + return false } + sum1, sum2 := tarChksum(raw) + return recsum == sum1 || recsum == sum2 +} - for _, i := range []uint8{135, 147, 155} { - if raw[i] != 0x00 && raw[i] != 0x20 { - return false - } +// tarParseOctal converts octal string to decimal int. +func tarParseOctal(b []byte) (int64, error) { + // Because unused fields are filled with NULs, we need to skip leading NULs. + // Fields may also be padded with spaces or NULs. + // So we remove leading and trailing NULs and spaces to be sure. + b = bytes.Trim(b, " \x00") + + if len(b) == 0 { + return 0, nil + } + x, err := strconv.ParseUint(tarParseString(b), 8, 64) + if err != nil { + return 0, err } + return int64(x), nil +} + +// tarParseString converts a NUL ended bytes slice to a string. +func tarParseString(b []byte) string { + if i := bytes.IndexByte(b, 0); i >= 0 { + return string(b[:i]) + } + return string(b) +} - return true +// tarChksum computes the checksum for the header block b. +// The actual checksum is written to same b block after it has been calculated. +// Before calculation the bytes from b reserved for checksum have placeholder +// value of ASCII space 0x20. +// POSIX specifies a sum of the unsigned byte values, but the Sun tar used +// signed byte values. We compute and return both. +func tarChksum(b []byte) (unsigned, signed int64) { + for i, c := range b { + if 148 <= i && i < 156 { + c = ' ' // Treat the checksum field itself as all spaces. + } + unsigned += int64(c) + signed += int64(int8(c)) + } + return unsigned, signed } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/gabriel-vasile/mimetype/internal/magic/magic.go new/vendor/github.com/gabriel-vasile/mimetype/internal/magic/magic.go --- old/vendor/github.com/gabriel-vasile/mimetype/internal/magic/magic.go 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/github.com/gabriel-vasile/mimetype/internal/magic/magic.go 2024-05-31 06:53:06.000000000 +0200 @@ -153,8 +153,11 @@ if len(raw) < 12 { return false } + if !bytes.Equal(raw[4:8], []byte("ftyp")) { + return false + } for _, s := range sigs { - if bytes.Equal(raw[4:12], append([]byte("ftyp"), s...)) { + if bytes.Equal(raw[8:12], s) { return true } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/gabriel-vasile/mimetype/internal/magic/text.go new/vendor/github.com/gabriel-vasile/mimetype/internal/magic/text.go --- old/vendor/github.com/gabriel-vasile/mimetype/internal/magic/text.go 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/github.com/gabriel-vasile/mimetype/internal/magic/text.go 2024-05-31 06:53:06.000000000 +0200 @@ -1,7 +1,6 @@ package magic import ( - "bufio" "bytes" "strings" "time" @@ -234,9 +233,10 @@ // types. func NdJSON(raw []byte, limit uint32) bool { lCount, hasObjOrArr := 0, false - sc := bufio.NewScanner(dropLastLine(raw, limit)) - for sc.Scan() { - l := sc.Bytes() + raw = dropLastLine(raw, limit) + var l []byte + for len(raw) != 0 { + l, raw = scanLine(raw) // Empty lines are allowed in NDJSON. if l = trimRWS(trimLWS(l)); len(l) == 0 { continue @@ -301,20 +301,15 @@ } // Srt matches a SubRip file. -func Srt(in []byte, _ uint32) bool { - s := bufio.NewScanner(bytes.NewReader(in)) - if !s.Scan() { - return false - } - // First line must be 1. - if s.Text() != "1" { - return false - } +func Srt(raw []byte, _ uint32) bool { + line, raw := scanLine(raw) - if !s.Scan() { + // First line must be 1. + if string(line) != "1" { return false } - secondLine := s.Text() + line, raw = scanLine(raw) + secondLine := string(line) // Timestamp format (e.g: 00:02:16,612 --> 00:02:19,376) limits secondLine // length to exactly 29 characters. if len(secondLine) != 29 { @@ -325,14 +320,12 @@ if strings.Contains(secondLine, ".") { return false } - // For Go <1.17, comma is not recognised as a decimal separator by `time.Parse`. - secondLine = strings.ReplaceAll(secondLine, ",", ".") // Second line must be a time range. ts := strings.Split(secondLine, " --> ") if len(ts) != 2 { return false } - const layout = "15:04:05.000" + const layout = "15:04:05,000" t0, err := time.Parse(layout, ts[0]) if err != nil { return false @@ -345,8 +338,9 @@ return false } + line, _ = scanLine(raw) // A third line must exist and not be empty. This is the actual subtitle text. - return s.Scan() && len(s.Bytes()) != 0 + return len(line) != 0 } // Vtt matches a Web Video Text Tracks (WebVTT) file. See @@ -373,3 +367,15 @@ return bytes.Equal(raw, []byte{0xEF, 0xBB, 0xBF, 0x57, 0x45, 0x42, 0x56, 0x54, 0x54}) || // UTF-8 BOM and "WEBVTT" bytes.Equal(raw, []byte{0x57, 0x45, 0x42, 0x56, 0x54, 0x54}) // "WEBVTT" } + +// dropCR drops a terminal \r from the data. +func dropCR(data []byte) []byte { + if len(data) > 0 && data[len(data)-1] == '\r' { + return data[0 : len(data)-1] + } + return data +} +func scanLine(b []byte) (line, remainder []byte) { + line, remainder, _ = bytes.Cut(b, []byte("\n")) + return dropCR(line), remainder +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/gabriel-vasile/mimetype/internal/magic/text_csv.go new/vendor/github.com/gabriel-vasile/mimetype/internal/magic/text_csv.go --- old/vendor/github.com/gabriel-vasile/mimetype/internal/magic/text_csv.go 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/github.com/gabriel-vasile/mimetype/internal/magic/text_csv.go 2024-05-31 06:53:06.000000000 +0200 @@ -18,7 +18,7 @@ } func sv(in []byte, comma rune, limit uint32) bool { - r := csv.NewReader(dropLastLine(in, limit)) + r := csv.NewReader(bytes.NewReader(dropLastLine(in, limit))) r.Comma = comma r.ReuseRecord = true r.LazyQuotes = true @@ -44,20 +44,14 @@ // mimetype limits itself to ReadLimit bytes when performing a detection. // This means, for file formats like CSV for NDJSON, the last line of the input // can be an incomplete line. -func dropLastLine(b []byte, cutAt uint32) io.Reader { - if cutAt == 0 { - return bytes.NewReader(b) +func dropLastLine(b []byte, readLimit uint32) []byte { + if readLimit == 0 || uint32(len(b)) < readLimit { + return b } - if uint32(len(b)) >= cutAt { - for i := cutAt - 1; i > 0; i-- { - if b[i] == '\n' { - return bytes.NewReader(b[:i]) - } + for i := len(b) - 1; i > 0; i-- { + if b[i] == '\n' { + return b[:i] } - - // No newline was found between the 0 index and cutAt. - return bytes.NewReader(b[:cutAt]) } - - return bytes.NewReader(b) + return b } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/gabriel-vasile/mimetype/mimetype.go new/vendor/github.com/gabriel-vasile/mimetype/mimetype.go --- old/vendor/github.com/gabriel-vasile/mimetype/mimetype.go 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/github.com/gabriel-vasile/mimetype/mimetype.go 2024-05-31 06:53:06.000000000 +0200 @@ -7,14 +7,15 @@ import ( "io" - "io/ioutil" "mime" "os" "sync/atomic" ) +var defaultLimit uint32 = 3072 + // readLimit is the maximum number of bytes from the input used when detecting. -var readLimit uint32 = 3072 +var readLimit uint32 = defaultLimit // Detect returns the MIME type found from the provided byte slice. // @@ -48,7 +49,7 @@ // Using atomic because readLimit can be written at the same time in other goroutine. l := atomic.LoadUint32(&readLimit) if l == 0 { - in, err = ioutil.ReadAll(r) + in, err = io.ReadAll(r) if err != nil { return errMIME, err } @@ -103,6 +104,7 @@ // SetLimit sets the maximum number of bytes read from input when detecting the MIME type. // Increasing the limit provides better detection for file formats which store // their magical numbers towards the end of the file: docx, pptx, xlsx, etc. +// During detection data is read in a single block of size limit, i.e. it is not buffered. // A limit of 0 means the whole input file will be used. func SetLimit(limit uint32) { // Using atomic because readLimit can be read at the same time in other goroutine. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/github.com/xmppo/go-xmpp/xmpp.go new/vendor/github.com/xmppo/go-xmpp/xmpp.go --- old/vendor/github.com/xmppo/go-xmpp/xmpp.go 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/github.com/xmppo/go-xmpp/xmpp.go 2024-05-31 06:53:06.000000000 +0200 @@ -92,10 +92,10 @@ shutdown bool // Variable signalling that the stream will be closed p *xml.Decoder stanzaWriter io.Writer - LimitMaxBytes int // Maximum stanza size (XEP-0478: Stream Limits Advertisement) - LimitIdleSeconds int // Maximum idle seconds (XEP-0478: Stream Limits Advertisement) - Mechanism string - Fast Fast // XEP-0484 FAST Token, mechanism and expiry. + LimitMaxBytes int // Maximum stanza size (XEP-0478: Stream Limits Advertisement) + LimitIdleSeconds int // Maximum idle seconds (XEP-0478: Stream Limits Advertisement) + Mechanism string // SCRAM mechanism used. + Fast Fast // XEP-0484 FAST Token, mechanism and expiry. } func (c *Client) JID() string { @@ -262,6 +262,9 @@ // MUST be a valid UUIDv4 UserAgentID string + // Enable XEP-0484: Fast Authentication Streamlining Tokens + Fast bool + // XEP-0484: Fast Authentication Streamlining Tokens // Fast Token FastToken string @@ -625,7 +628,7 @@ if o.UserAgentID != "" { userAgentID = fmt.Sprintf(" id='%s'", o.UserAgentID) } - if f.Authentication.Inline.Fast.Mechanism != nil && o.UserAgentID != "" && c.IsEncrypted() { + if o.Fast && f.Authentication.Inline.Fast.Mechanism != nil && o.UserAgentID != "" && c.IsEncrypted() { var mech string if o.FastToken == "" { m := f.Authentication.Inline.Fast.Mechanism @@ -1146,12 +1149,21 @@ c.stanzaWriter = c.conn } - _, err := fmt.Fprintf(c.stanzaWriter, "<?xml version='1.0'?>"+ - "<stream:stream from='%s' to='%s' xmlns='%s'"+ - " xmlns:stream='%s' version='1.0'>\n", - xmlEscape(o.User), xmlEscape(domain), nsClient, nsStream) - if err != nil { - return nil, err + if c.IsEncrypted() { + _, err := fmt.Fprintf(c.stanzaWriter, "<?xml version='1.0'?>"+ + "<stream:stream from='%s' to='%s' xmlns='%s'"+ + " xmlns:stream='%s' version='1.0'>\n", + xmlEscape(o.User), xmlEscape(domain), nsClient, nsStream) + if err != nil { + return nil, err + } + } else { + _, err := fmt.Fprintf(c.stanzaWriter, "<?xml version='1.0'?>"+ + "<stream:stream to='%s' xmlns='%s' xmlns:stream='%s' version='1.0'>\n", + xmlEscape(domain), nsClient, nsStream) + if err != nil { + return nil, err + } } // We expect the server to start a <stream>. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/golang.org/x/crypto/sha3/sha3_s390x.go new/vendor/golang.org/x/crypto/sha3/sha3_s390x.go --- old/vendor/golang.org/x/crypto/sha3/sha3_s390x.go 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/golang.org/x/crypto/sha3/sha3_s390x.go 2024-05-31 06:53:06.000000000 +0200 @@ -143,6 +143,12 @@ // Read squeezes an arbitrary number of bytes from the sponge. func (s *asmState) Read(out []byte) (n int, err error) { + // The 'compute last message digest' instruction only stores the digest + // at the first operand (dst) for SHAKE functions. + if s.function != shake_128 && s.function != shake_256 { + panic("sha3: can only call Read for SHAKE functions") + } + n = len(out) // need to pad if we were absorbing @@ -202,8 +208,17 @@ // Hash the buffer. Note that we don't clear it because we // aren't updating the state. - klmd(s.function, &a, nil, s.buf) - return append(b, a[:s.outputLen]...) + switch s.function { + case sha3_224, sha3_256, sha3_384, sha3_512: + klmd(s.function, &a, nil, s.buf) + return append(b, a[:s.outputLen]...) + case shake_128, shake_256: + d := make([]byte, s.outputLen, 64) + klmd(s.function, &a, d, s.buf) + return append(b, d[:s.outputLen]...) + default: + panic("sha3: unknown function") + } } // Reset resets the Hash to its initial state. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/golang.org/x/net/html/doc.go new/vendor/golang.org/x/net/html/doc.go --- old/vendor/golang.org/x/net/html/doc.go 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/golang.org/x/net/html/doc.go 2024-05-31 06:53:06.000000000 +0200 @@ -104,7 +104,7 @@ parsing specification respectively. While the tokenizer parses and normalizes individual HTML tokens, only the parser constructs the DOM tree from the tokenized HTML, as described in the tree construction stage of the -specification, dynamically modifying or extending the docuemnt's DOM tree. +specification, dynamically modifying or extending the document's DOM tree. If your use case requires semantically well-formed HTML documents, as defined by the WHATWG specification, the parser should be used rather than the tokenizer. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/golang.org/x/sys/cpu/cpu.go new/vendor/golang.org/x/sys/cpu/cpu.go --- old/vendor/golang.org/x/sys/cpu/cpu.go 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/golang.org/x/sys/cpu/cpu.go 2024-05-31 06:53:06.000000000 +0200 @@ -103,6 +103,7 @@ HasASIMDDP bool // Advanced SIMD double precision instruction set HasSHA512 bool // SHA512 hardware implementation HasSVE bool // Scalable Vector Extensions + HasSVE2 bool // Scalable Vector Extensions 2 HasASIMDFHM bool // Advanced SIMD multiplication FP16 to FP32 _ CacheLinePad } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/golang.org/x/sys/cpu/cpu_arm64.go new/vendor/golang.org/x/sys/cpu/cpu_arm64.go --- old/vendor/golang.org/x/sys/cpu/cpu_arm64.go 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/golang.org/x/sys/cpu/cpu_arm64.go 2024-05-31 06:53:06.000000000 +0200 @@ -28,6 +28,7 @@ {Name: "sm3", Feature: &ARM64.HasSM3}, {Name: "sm4", Feature: &ARM64.HasSM4}, {Name: "sve", Feature: &ARM64.HasSVE}, + {Name: "sve2", Feature: &ARM64.HasSVE2}, {Name: "crc32", Feature: &ARM64.HasCRC32}, {Name: "atomics", Feature: &ARM64.HasATOMICS}, {Name: "asimdhp", Feature: &ARM64.HasASIMDHP}, @@ -164,6 +165,15 @@ switch extractBits(pfr0, 32, 35) { case 1: ARM64.HasSVE = true + + parseARM64SVERegister(getzfr0()) + } +} + +func parseARM64SVERegister(zfr0 uint64) { + switch extractBits(zfr0, 0, 3) { + case 1: + ARM64.HasSVE2 = true } } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/golang.org/x/sys/cpu/cpu_arm64.s new/vendor/golang.org/x/sys/cpu/cpu_arm64.s --- old/vendor/golang.org/x/sys/cpu/cpu_arm64.s 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/golang.org/x/sys/cpu/cpu_arm64.s 2024-05-31 06:53:06.000000000 +0200 @@ -29,3 +29,11 @@ WORD $0xd5380400 MOVD R0, ret+0(FP) RET + +// func getzfr0() uint64 +TEXT ·getzfr0(SB),NOSPLIT,$0-8 + // get SVE Feature Register 0 into x0 + // mrs x0, ID_AA64ZFR0_EL1 = d5380480 + WORD $0xd5380480 + MOVD R0, ret+0(FP) + RET diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go new/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go --- old/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/golang.org/x/sys/cpu/cpu_gc_arm64.go 2024-05-31 06:53:06.000000000 +0200 @@ -9,3 +9,4 @@ func getisar0() uint64 func getisar1() uint64 func getpfr0() uint64 +func getzfr0() uint64 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go new/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go --- old/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/golang.org/x/sys/cpu/cpu_linux_arm64.go 2024-05-31 06:53:06.000000000 +0200 @@ -35,6 +35,8 @@ hwcap_SHA512 = 1 << 21 hwcap_SVE = 1 << 22 hwcap_ASIMDFHM = 1 << 23 + + hwcap2_SVE2 = 1 << 1 ) // linuxKernelCanEmulateCPUID reports whether we're running @@ -104,6 +106,9 @@ ARM64.HasSHA512 = isSet(hwCap, hwcap_SHA512) ARM64.HasSVE = isSet(hwCap, hwcap_SVE) ARM64.HasASIMDFHM = isSet(hwCap, hwcap_ASIMDFHM) + + // HWCAP2 feature bits + ARM64.HasSVE2 = isSet(hwCap2, hwcap2_SVE2) } func isSet(hwc uint, value uint) bool { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/vendor/modules.txt new/vendor/modules.txt --- old/vendor/modules.txt 2024-04-15 10:13:32.000000000 +0200 +++ new/vendor/modules.txt 2024-05-31 06:53:06.000000000 +0200 @@ -28,11 +28,11 @@ github.com/ProtonMail/gopenpgp/v2/constants github.com/ProtonMail/gopenpgp/v2/crypto github.com/ProtonMail/gopenpgp/v2/internal -# github.com/beevik/etree v1.3.0 -## explicit; go 1.13 +# github.com/beevik/etree v1.4.0 +## explicit; go 1.16 github.com/beevik/etree -# github.com/cloudflare/circl v1.3.7 -## explicit; go 1.19 +# github.com/cloudflare/circl v1.3.8 +## explicit; go 1.21 github.com/cloudflare/circl/dh/x25519 github.com/cloudflare/circl/dh/x448 github.com/cloudflare/circl/ecc/goldilocks @@ -45,7 +45,7 @@ github.com/cloudflare/circl/sign github.com/cloudflare/circl/sign/ed25519 github.com/cloudflare/circl/sign/ed448 -# github.com/gabriel-vasile/mimetype v1.4.3 +# github.com/gabriel-vasile/mimetype v1.4.4 ## explicit; go 1.20 github.com/gabriel-vasile/mimetype github.com/gabriel-vasile/mimetype/internal/charset @@ -60,10 +60,10 @@ # github.com/pkg/errors v0.9.1 ## explicit github.com/pkg/errors -# github.com/xmppo/go-xmpp v0.2.0 +# github.com/xmppo/go-xmpp v0.2.1 ## explicit; go 1.21.5 github.com/xmppo/go-xmpp -# golang.org/x/crypto v0.22.0 +# golang.org/x/crypto v0.23.0 ## explicit; go 1.18 golang.org/x/crypto/argon2 golang.org/x/crypto/blake2b @@ -72,16 +72,16 @@ golang.org/x/crypto/pbkdf2 golang.org/x/crypto/scrypt golang.org/x/crypto/sha3 -# golang.org/x/net v0.24.0 +# golang.org/x/net v0.25.0 ## explicit; go 1.18 golang.org/x/net/html golang.org/x/net/html/atom golang.org/x/net/internal/socks golang.org/x/net/proxy -# golang.org/x/sys v0.19.0 +# golang.org/x/sys v0.20.0 ## explicit; go 1.18 golang.org/x/sys/cpu -# golang.org/x/text v0.14.0 +# golang.org/x/text v0.15.0 ## explicit; go 1.18 golang.org/x/text/encoding golang.org/x/text/encoding/charmap
participants (1)
-
Source-Sync