Commit Graph

83 Commits (master)

Author SHA1 Message Date
Michael Santos 73e1f03625 termux/android: stdin: remove call to fcntl()
Remove an unnecessary call to put stdin into non-blocking mode. On
termux/android, xmppipe is aborted when the fd capability set is
changed:

```
FORTIFY: fcntl(F_SETFD) passed non-FD_CLOEXEC flag: 0x800
libc: FORTIFY: fcntl(F_SETFD) passed non-FD_CLOEXEC flag: 0x800
libc: Fatal signal 6 (SIGABRT), code -1 (SI_QUEUE) in tid 32292
(xmppipe), pid 32292 (<unknown>)
libc: failed to spawn debuggerd dispatch thread: Try again
```
6 months ago
Michael Santos bcb3cc20b6 0.16.0 7 months ago
Michael Santos 56424a335a --format=csv: increase default buffer size
Input is percent-encoded when colon separated values mode is
enabled. Account for the percent encoding overhead (each character is
encoded as 3 characters) in the default buffer size.

Work around for message boundary bugs in csv mode, e.g.,
* only the first lihe delimited value is read: multiple lines may be in
  the buffer
* a buffer may contain a partial message
7 months ago
Michael Santos 49133ef253 ping: use a constant stanza ID 7 months ago
Michael Santos f763e31ffd muc,send: constify 7 months ago
Michael Santos f8db1cbd99 util: constify 7 months ago
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 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.
11 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 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 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 7bbf51567b 0.14.2
Tag release for https://github.com/msantos/xmppipe/issues/6

Thanks @anjandev!
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 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 4997f4be2c 0.14.0 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 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 5f2c3003ff v0.13.0
Update usage with --format option.
5 years ago
Michael Santos 2a75c3373a Always display chat markers
Remove the option to explicitly enable/disable chat markers.
5 years ago
Michael Santos c8774e591c strtonum: fix prototype warning 5 years ago
Michael Santos 396188ea87 xmppipe.h: fix prototype 5 years ago
Michael Santos 287bb92aee vesion: free allocated stanzas 5 years ago
Michael Santos 1bb03b563e xmppipe_send_message: fix memory leak
Fix a memory leak caused by improper usage of
xmpp_stanza_new()/xmpp_stanza_release() by replacing usage with the
simpler xmpp_message_new()/xmpp_message_set_body() API available in
libstrophe 0.9.0, as advised by @pasis.

Fixes https://github.com/msantos/xmppipe/issues/3.
5 years ago
Michael Santos 8792a8a05c Mark fun as static 5 years ago
Michael Santos e00a7fddd2 Consistently format using clang-format 5 years ago
Michael Santos b3991577aa reorg: event_loop: move to separate file 5 years ago
Michael Santos a8cc5b730a Remove unused function declaration 5 years ago
Michael Santos 4081ab67cb reorg: muc_unlock 5 years ago
Michael Santos 5165f8a1a4 reorg: muc_subject 5 years ago
Michael Santos 9d6b58ba26 reorg: muc: join 5 years ago
Michael Santos 6731de9a13 reorg: ping 5 years ago
Michael Santos 0ba9e92eda reorg: stream management: ack 5 years ago
Michael Santos ee0f59516b reorg: stream_close: move to util for now 5 years ago
Michael Santos 862ab6d313 reorg: stream management: request 5 years ago
Michael Santos 5cb7647e75 reorg: stream management: check if enabled 5 years ago
Michael Santos c5f0f7b662 reorg: presence error handler 5 years ago
Michael Santos 0b22ad4302 reorg: presence handler 5 years ago
Michael Santos 8b1374a25a reorg: move next_state to util 5 years ago
Michael Santos d150e63735 reorg: null handler 5 years ago
Michael Santos b3468de16f reorg: ping handler 5 years ago
Michael Santos 9a98b8b9bf reorg: version handler 5 years ago
Michael Santos 895ad40ee2 reorg: xmppipe_send* 5 years ago
Michael Santos a365e18b59 reorg: message: organize by handler 5 years ago
Michael Santos 026890d377 Add experimental support for chat markers
Support chat marker (XEP-0333) stanzas when the "--chat-marker" switch
is provided on the command line. A chat marker is prefixed by 'M':

~~~
M:groupchat:test@conference.example.com/msantos:me@example.com/162315501161646113068402:
~~~

The idea is to allow scripts to react based on whether a message has
been read, for example, escalating via other channels.
5 years ago