Commit Graph

73 Commits (bc3bd956481131a15dcae95eb818b3b3ccc7ed79)

Author SHA1 Message Date
Klemens Nanni bc3bd95648 Drop filesystem access iff possible
Log files and state save/restore both require read/write access to
the filesystem, both during start and exit.

If neither features are used, catgirl may run with "stdio tty".
2021-01-23 00:48:19 -05:00
Klemens Nanni 837c9efce4 Drop exec capability iff restricted
Nothing must be executed when running /copy, et al.
2021-01-23 00:48:19 -05:00
Klemens Nanni c93c56e4e5 Drop network capability after ircConnect()
catgirl has no reconnect feature and generally must not do
anything but read/write from/to the connected socket which
does not require "inet" or "dns" promises.
2021-01-23 00:48:19 -05:00
Klemens Nanni a19f48d840 Call pledge(2) after unveil(2)
Simplify logic, be more idiomatic and finalize by pledging after
all unveiling is done by omitting the "unveil" promise and thereby
not allowing further calls to it.
2021-01-23 00:48:19 -05:00
C. McEnroe 95bb627ffb Separate kiosk mode from restrict mode
Restrict mode will focus on sandboxing, while kiosk will continue
to restrict IRC access through a public kiosk. Kiosk mode without
restrict mode allows execution of man 1 catgirl with /help, assuming
external sandboxing.

The /list and /part commands are also added to the list of disabled
commands in kiosk mode, since they are pointless without access to
/join.
2021-01-23 00:48:15 -05:00
C. McEnroe 063f2aaa0c Add -I highlight option and /highlight 2021-01-16 14:15:00 -05:00
C. McEnroe 5a490945ea Rename ignore code to filter 2021-01-16 13:36:39 -05:00
C. McEnroe df280aa7d6 Sandbox with unveil(2) on OpenBSD in restricted mode
I wrote all this in vi and it was nice.
2021-01-10 19:23:01 -05:00
C. McEnroe c6cd90c2dd Print chain to stdout with -o 2021-01-10 18:00:41 -05:00
C. McEnroe 7b8bd50063 Exit immediately when using -o 2021-01-10 11:47:48 -05:00
C. McEnroe e42b3aa08e Add -o and -t options to trust self-signed certificates 2021-01-09 19:11:57 -05:00
C. McEnroe a324795b86 Allow configuring the upper bound of the hash function
This allows limiting the nick colors used to the 16-color terminal set
without modifying the TERM environment variable. Produces different
results from just using the default configuration in a 16-color
terminal, but what can you do?
2021-01-09 17:58:29 -05:00
C. McEnroe 9ea029c580 Sandbox with pledge(2) on OpenBSD 2021-01-06 21:47:56 -05:00
C. McEnroe d6b4aed4df Split /exec lines by \r as well as \n
This fixes local rendering of /exec toilet --irc, which outputs \r\n
line endings.
2020-11-24 19:15:57 -05:00
C. McEnroe 59006d18bb Avoid eating C-c while connecting
Split UI initialization into two steps either side of the call to
connect, so that C-c works as interrupt while it's blocked.
2020-10-12 19:25:08 -04:00
C. McEnroe d9a0364cb4 Use configPath to load TLS cert/priv 2020-08-20 14:56:13 -04:00
C. McEnroe 814c36223a Say "OpenSSL" in additional permission notices
LibreSSL is "a modified version of that library".
2020-08-04 12:19:14 -04:00
C. McEnroe 94fb9798c5 Bump ParamCap to 254
Apparently IRCds have decided that the 15-parameter limit doesn't matter
anymore. 254 is the maximum number of single-byte parameters (following
a single-byte command) which fit in a 512-byte CR-LF-terminated line.
When everyone decides that the 512-byte line length limit doesn't matter
either, I will delete my software and people can use some JavaScript
garbage instead.

This makes struct Message 2080 bytes, but there's only ever one or two
of them around at once. Avoid passing it by value to handle.
2020-06-24 13:36:24 -04:00
C. McEnroe 721c3a9ee6 Add additional permission for linking with LibreSSL
https://www.gnu.org/licenses/gpl-faq.en.html#GPLIncompatibleLibs
2020-06-08 17:48:07 -04:00
C. McEnroe 4282574c18 Revert "Send blank line after 10 minutes idle"
This reverts commit 1d5c4a5e34.

This is fixed instead by pounce using TCP keepalive.
2020-05-18 14:48:22 -04:00
C. McEnroe 2d36c4d7c9 Use a for loop for getopt 2020-04-02 16:13:23 -04:00
C. McEnroe 06543b7030 Generate short option string with a loop
Also change the way option structs are initialized so that the array
sorts the same way as the switch statement.
2020-04-02 14:14:43 -04:00
C. McEnroe 25f419465f Add /ignore message filtering patterns 2020-03-31 14:30:42 -04:00
C. McEnroe ff78362826 Replace some declaration; while loops with for loops
I should have been using this for getopt loops already but the call here
is slightly too long to fit on one line as a for loop.
2020-03-30 19:44:45 -04:00
C. McEnroe a0dde10cb6 Add text macros 2020-03-30 14:56:26 -04:00
C. McEnroe d99f20c0ff Add logging functions
The mkdir dance is a bit awkward...
2020-03-25 18:56:09 -04:00
C. McEnroe cf1545870a Assume worst case for unknown user and host in splitMessage
The default USERLEN of 9 doesn't have a great source, the RFC only says
that nicks are length 9, so my assumption is that usernames are not
longer.
2020-03-23 13:25:10 -04:00
C. McEnroe 1d5c4a5e34 Send blank line after 10 minutes idle
Without this, I was having catgirl "time out" from pounce's POV, but
without catgirl noticing anything... I still don't understand this. Been
using this fix for a couple weeks though and it stopped happening, and
it's otherwise harmless, but yikes.
2020-03-17 11:58:50 -04:00
C. McEnroe b20be7cbad Various small cleanups
Haven't really gone through ui.c yet.
2020-02-16 23:05:43 -05:00
C. McEnroe fa4e81d480 Set defaults for various types of modes
These are actually from RFC 1459, since that seems to be the more likely
lowest common denominator, so I should maybe it it to STANDARDS (along
with ircdocs' section on ISUPPORT). RFC 2812 has a lot of stuff that
isn't currently used.
2020-02-15 22:59:04 -05:00
C. McEnroe 700b5d5870 Replace small integers in size_t with uint 2020-02-15 22:19:55 -05:00
C. McEnroe 42d106260b Separate network info from self 2020-02-15 04:54:53 -05:00
C. McEnroe 46f61dfcdc Add /exec 2020-02-13 22:22:11 -05:00
C. McEnroe 1e226593ef Rename procPipe to utilPipe 2020-02-13 21:57:55 -05:00
C. McEnroe fcfbe8a14c Add -g for generating certificates
Copied from pounce.
2020-02-13 01:39:25 -05:00
C. McEnroe 0a772ff139 Explicitly close the TLS connection
Just to be nice.
2020-02-13 01:01:23 -05:00
C. McEnroe 180bbc7b38 Add -N flag for notifications 2020-02-12 20:12:34 -05:00
multiplexd 1e544ce482 Implement source address selection
This commit adds a '-S' command line option and a "bind"
configuration file option to specify the source address to bind to when
connecting to the IRC server.
2020-02-13 00:05:52 +00:00
C. McEnroe d73085eaa9 Allow for arguments to open/copy utilities 2020-02-12 00:48:43 -05:00
C. McEnroe 10ae7bedbd Add -R restricted flag 2020-02-11 22:39:29 -05:00
C. McEnroe 62472ab183 Add startup GPLv3 note and URL
I am a degenerate.
2020-02-11 19:43:55 -05:00
C. McEnroe cc80fae758 Set self.nick to * initially
Allows removing a bunch of checks that self.nick is set, and it's what
the server usually calls you before registration.

Never highlight notices as mentions.
2020-02-11 17:52:55 -05:00
C. McEnroe babd3b0a6c Synthesize a QUIT message to handle on exit
So that the end of a saved buffer contains the self quit.
2020-02-10 20:06:25 -05:00
C. McEnroe 99480a42e5 Factor out XDG base directory code
And add warnings to configOpen, since that's the only way to be accurate
if a weird error occurs.
2020-02-10 19:57:10 -05:00
C. McEnroe b59431bb15 Add -s to save and load buffers 2020-02-10 19:40:13 -05:00
C. McEnroe 0d93e66a68 Add -H 2020-02-10 05:50:28 -05:00
C. McEnroe 5254e1035c Add /help
Now with automatic search! Also had to fix the SIGCHLD handling...
2020-02-09 14:09:27 -05:00
C. McEnroe 3e68684148 Add /copy 2020-02-08 21:44:50 -05:00
C. McEnroe 2db17e83a9 Allow overriding the /open utility 2020-02-08 21:21:21 -05:00
C. McEnroe 362d779b61 Set FDs CLOEXEC 2020-02-08 19:12:05 -05:00