2
0
mirror of https://github.com/msantos/xmppipe synced 2024-11-16 00:12:59 +00:00
Commit Graph

265 Commits

Author SHA1 Message Date
Michael Santos
018662c2ef send: remove variable reinitializations 2023-10-19 07:08:09 -04:00
Michael Santos
0bcbd72f86 fmt: remove variable reinitializations 2023-10-18 06:43:47 -04:00
Michael Santos
2181666812 conn, event: remove variable reinitializations 2023-10-13 07:29:46 -04:00
Michael Santos
f987fd95e7 cleanup: variable reinitializations 2023-10-12 07:18:19 -04:00
Michael Santos
56ef393916 cleanup: remove variable reinitialization 2023-10-11 07:48:27 -04:00
Michael Santos
2a22204ff2 cleanup: duplicate variable initialization 2023-10-10 06:49:30 -04:00
Michael Santos
21e7da86b4 cleanup: strtonum: error check 2023-10-09 08:28:03 -04:00
Michael Santos
1da079b53d capsicum: close any unknown fd's 2023-10-07 07:45:56 -04:00
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
2023-09-14 09:35:46 -04:00
Michael Santos
78807f1b15 build: enable warnings 2023-08-03 06:57:59 -04:00
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.
2023-06-22 07:16:07 -04:00
Michael Santos
ff574f6412 capsicum: disable fs writes
Use RLIMIT_FSIZE to disable writes to the filesystem when stdout is not
a regular file.
2023-06-06 06:12:56 -04:00
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
2023-06-05 06:53:35 -04:00
Michael Santos
29d29f21c7 rlimit: disable fs writes
Use RLIMIT_FSIZE to disable writes to the filesystem when stdout is not
a regular file.
2023-06-04 06:30:15 -04:00
Michael Santos
1b9986edcc seccomp: remove duplicates, allow mremap in stdin mode 2023-03-12 07:23:41 -04:00
Michael Santos
42d524be45 README: reformat, cleanup 2023-03-11 06:20:53 -05:00
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.
2023-03-10 07:21:00 -05:00
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
2023-03-09 07:19:44 -05:00
Michael Santos
548a1590f5 Fix function declarations without prototypes 2023-03-08 07:52:32 -05:00
Michael Santos
8e25057316 Fix typo in comment 2023-02-10 07:48:58 -05:00
Michael Santos
f58742d7e0 examples: cleanup: use coproc 2022-09-26 07:29:19 -04:00
Michael Santos
11d854f9e7 0.14.5: fix usage 2022-09-19 08:50:07 -04:00
Michael Santos
840ef08251 0.14.4: standardize exit status
* 2: usage errors
* 0: usage (-h)
2022-09-09 08:25:02 -04:00
Michael Santos
771822da1a 0.14.3: seccomp: add syscalls
Add syscalls for Ubuntu 22.04.
2022-08-16 07:28:18 -04:00
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
2022-06-18 10:07:14 -04:00
Michael Santos
7bbf51567b 0.14.2
Tag release for https://github.com/msantos/xmppipe/issues/6

Thanks @anjandev!
2022-02-07 08:29:15 -05:00
Michael Santos
a3a29bbba6 cleanup: move common operation to function 2022-02-03 08:48:47 -05:00
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
2022-02-02 07:43:59 -05:00
Michael Santos
20b987ce21 README: cleanup 2022-01-31 08:27:59 -05:00
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
```
2022-01-28 08:22:14 -05:00
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).
2022-01-27 08:36:45 -05:00
Michael Santos
e1cbff0f14 Makefile: update static target for Ubuntu 20.04+ 2022-01-26 13:12:49 -05:00
Michael Santos
2bece1a74d README: sandbox->restrict_process 2020-09-12 07:03:43 -04:00
Michael Santos
a4bba88e40 README: fix typos 2020-08-21 08:12:54 -04:00
Michael Santos
5b23af5675 README: run shellcheck on examples 2020-08-20 06:19:10 -04:00
Michael Santos
80135667d6 usage: cleanup 2020-07-31 07:41:26 -04:00
Michael Santos
0ba12c23af seccomp: allow ppoll(), faccessat() 2020-07-26 06:36:22 -04:00
Michael Santos
85c13af092 README: add HTTP upload, inline image example; formatting 2020-07-07 08:05:05 -04:00
Michael Santos
f80ab9c65e Update README/usage 2020-07-04 07:21:01 -04:00
Michael Santos
91a43f2433 -V/--version: display version information 2020-07-04 07:19:16 -04:00
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.
~~~
2020-07-02 07:33:50 -04:00
Michael Santos
4997f4be2c 0.14.0 2020-07-01 08:04:31 -04:00
Michael Santos
25d8272656 examples: format and run shellcheck
~~~
shfmt -i 2 -ci -w examples
shellcheck examples/*
~~~
2020-06-30 16:13:07 -04:00
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
2020-06-29 08:20:07 -04:00
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.
2020-06-28 10:28:15 -04:00
Michael Santos
45e96e6ea9 s/XMPPIPE_RESTRICT/RESTRICT/gi 2019-12-21 08:44:53 -05:00
Michael Santos
7dda5bafcd sandbox->restrict_process 2019-12-20 10:51:27 -05:00
Michael Santos
fa88bc9f6d seccomp: allow running on termux 2019-11-29 10:12:39 -05:00
Michael Santos
d708ce27b9 sandbox: fix pledge on openbsd 6.6 2019-11-26 08:49:16 -05:00
Michael Santos
2e05ea3808 README: update compatibility list 2019-07-27 10:59:49 -04:00