Commit Graph

257 Commits (4d79bddf566ccc207a6b13e798f3715d5ccfff49)
 

Author SHA1 Message Date
Michael Santos 4d79bddf56 ping: install a pong handler
Respond to server pings:

https://xmpp.org/extensions/xep-0199.html#s2c

```
xmpp DEBUG RECV: <iq id="rr-1694698253331-17375542133555098656-wf3J7kbG6j8Ft5Vx0cMY99txsW8=-55238004" type="get" to="msantos@example.com/110052433108464573191602" from="example.com"><ping xmlns="urn:xmpp:ping"/></iq>
conn DEBUG SENT: <iq id="rr-1694698253331-17375542133555098656-wf3J7kbG6j8Ft5Vx0cMY99txsW8=-55238004" to="example.com" type="result" from="msantos@example.com/110052433108464573191602"/>
```

Thanks @jessiehowell !

Fixes https://github.com/msantos/xmppipe/issues/9
9 months ago
Michael Santos 78807f1b15 build: enable warnings 10 months ago
Michael Santos 24b5a81456 Replace ctype usage
The ctype functions are error prone. The argument is an int which must
be in the range of an unsigned char and is interpreted based on the
locale:

    These functions check whether c, which must have the value of
    an unsigned char or EOF, falls into a certain character class
    according to the  specified  locale. The  functions without the
    "_l" suffix perform the check based on the current locale.
12 months ago
Michael Santos ff574f6412 capsicum: disable fs writes
Use RLIMIT_FSIZE to disable writes to the filesystem when stdout is not
a regular file.
1 year ago
Michael Santos 1a180c7655 rlimit: test if stdout is a file
Fix rlimit process restriction in commit 29d29f21:
* fd 1 is opened by the parent: enforce restrictions at startup
* enable RLIMIT_FSIZE if fd 2 is not a regular file
* fix compile error
1 year ago
Michael Santos 29d29f21c7 rlimit: disable fs writes
Use RLIMIT_FSIZE to disable writes to the filesystem when stdout is not
a regular file.
1 year ago
Michael Santos 1b9986edcc seccomp: remove duplicates, allow mremap in stdin mode 1 year ago
Michael Santos 42d524be45 README: reformat, cleanup 1 year ago
Michael Santos f6c1fd34ca 0.14.7: strophe 0.12: fix exit 1 on disconnect
With strophe 0.12, xmppipe printed an error "handle_connection:
disconnected" and exited with status 1 when the connection to the server
is closed.
1 year ago
Michael Santos d8a6890873 0.14.6: disable strophe stream management
libstrophe 0.12 supports (and enables by default) stream management. The
xmppipe session disconnects when strophe and xmppipe both try to handle
the stream acknowledgement.

* disable strophe stream management
* TODO: if strophe SM is available, disable xmppipe SM
1 year ago
Michael Santos 548a1590f5 Fix function declarations without prototypes 1 year ago
Michael Santos 8e25057316 Fix typo in comment 1 year ago
Michael Santos f58742d7e0 examples: cleanup: use coproc 2 years ago
Michael Santos 11d854f9e7 0.14.5: fix usage 2 years ago
Michael Santos 840ef08251 0.14.4: standardize exit status
* 2: usage errors
* 0: usage (-h)
2 years ago
Michael Santos 771822da1a 0.14.3: seccomp: add syscalls
Add syscalls for Ubuntu 22.04.
2 years ago
Michael Santos fc84ad2e9b seccomp: allow clock_gettime64
xmppipe aborts with bad system call on raspbian 11 (debian bullseye).

Possibly fixes https://github.com/msantos/xmppipe/issues/7
2 years ago
Michael Santos 7bbf51567b 0.14.2
Tag release for https://github.com/msantos/xmppipe/issues/6

Thanks @anjandev!
2 years ago
Michael Santos a3a29bbba6 cleanup: move common operation to function 2 years ago
Michael Santos 2df5896df2 Set a unique default resource
The default resource is "xmppipe". A subsequent xmppipe using the default
resource connects to the groupchat will be disconnected.

* reduce the amount of configuration needed for scripts
* make the resource unique on the same host by appending the PID
2 years ago
Michael Santos 20b987ce21 README: cleanup 2 years ago
Michael Santos f9bdddd910 0.14.1: --chat: fix use of username without domain
One to one chats with a username without a domain would echo back
messages. Use the domain from the user's JID:

```
xmppipe -u user1@example.com --chat user2
```
2 years ago
Michael Santos 15859bb11e seccomp: allowlist for termux/android 12
Update syscalls in seccomp policy for termux on android 12. With this
change, xmppipe works with the seccomp process restrictions on termux
but will still crash on exit:

* prctl(PR_SET_VMA): prctl(2) is not allowed by the stdin restrictions

* if prctl(2) is allowed, xmppipe aborts with "bad syscall" on exit. The
  system call doesn't show up in strace(1).
2 years ago
Michael Santos e1cbff0f14 Makefile: update static target for Ubuntu 20.04+ 2 years ago
Michael Santos 2bece1a74d README: sandbox->restrict_process 4 years ago
Michael Santos a4bba88e40 README: fix typos 4 years ago
Michael Santos 5b23af5675 README: run shellcheck on examples 4 years ago
Michael Santos 80135667d6 usage: cleanup 4 years ago
Michael Santos 0ba12c23af seccomp: allow ppoll(), faccessat() 4 years ago
Michael Santos 85c13af092 README: add HTTP upload, inline image example; formatting 4 years ago
Michael Santos f80ab9c65e Update README/usage 4 years ago
Michael Santos 91a43f2433 -V/--version: display version information 4 years ago
Michael Santos 69391951c8 freebsd: fix capsicum warning
~~~
In file included from src/restrict_process_capsicum.c:16:                   /usr/include/sys/capability.h:44:2: warning: this file includes <sys/capability.h> which is deprecated [-W#warnings]
 ^
1 warning generated.
~~~
4 years ago
Michael Santos 4997f4be2c 0.14.0 4 years ago
Michael Santos 25d8272656 examples: format and run shellcheck
~~~
shfmt -i 2 -ci -w examples
shellcheck examples/*
~~~
4 years ago
Michael Santos 11ee1c92f4 image-upload: example of uploading images
An example bot for:
* creating an HTTP upload slot
* using curl to put the image file
* displaying the image inline
4 years ago
Michael Santos c4b7c7d79c README: inline images, XEP-0363 HTTP Uploads
Document the support for inline images for displaying images in clients
like Conversations and for creating upload slots for files.
4 years ago
Michael Santos 45e96e6ea9 s/XMPPIPE_RESTRICT/RESTRICT/gi 5 years ago
Michael Santos 7dda5bafcd sandbox->restrict_process 5 years ago
Michael Santos fa88bc9f6d seccomp: allow running on termux 5 years ago
Michael Santos d708ce27b9 sandbox: fix pledge on openbsd 6.6 5 years ago
Michael Santos 2e05ea3808 README: update compatibility list 5 years ago
Michael Santos abfa336640 xmppipe_uuid_gen: xmpp_uuid_gen NULL check wrapper 5 years ago
Michael Santos ad1bf58c55 xmppipe_send: move internal functions 5 years ago
Michael Santos 31d6a03bfc XEP-0363: HTTP File Upload
Add initial support for XEP-0363. HTTP uploads can be used when colon
separated values for stdin is enabled:

~~~

u::::<filename>|<size (bytes)>[|<content-type>]

u::::example.png%7C16698

u::::tr.png%7C16698%7Cimage%2Fpng
~~~

The reponse:

~~~
U:upload.example.com:user@example.com/477937350262208314215778:https%3A%2F%2Fexample.com%2Fupload%2F1234%2Fabc%2Fexample.png%7Chttps%3A%2F%2Fexample.com%2Fupload%2F1234%2Fabc%2Fexample.png
~~~

TODO:

* support PUT header elements
* support/test error conditions

Questions:

* save the maximum file size returned by the server and disallow uploads
  larger than the value?

* xmppipe is "pinned" to the upload server returned in the IQ reply (the
  "to" field is ignored)

  * allow other upload servers?
  * error if different upload server is specified in "u:<from>:<to>"?
5 years ago
Michael Santos 11bc581608 oob inline image: u -> I 5 years ago
Michael Santos 3119d639ca version: add child stanza before release 5 years ago
Michael Santos cb21c2860e Support inline images
When using the csv input format, add a new format ('u') that wraps the
message in an "x:oob" element. The image will be displayed inline by
Conversations.

~~~
u:groupchat:::https%3A%2F%2Fhttpstatusdogs.com%2Fimg%2F500.jpg
~~~
5 years ago
Michael Santos 5f2c3003ff v0.13.0
Update usage with --format option.
5 years ago
Michael Santos a45b734211 options: remove --chat-marker 5 years ago