Art Cancro [Wed, 27 Mar 2024 15:47:55 +0000 (08:47 -0700)]
validate_recipients() remove extra copy of recipients
We no longer need to copy recipients_in to recipients, because we no longer
destructively tokenize it. Now we non-destructively tokenize it into an array.
Also I discovered that there is an unused parameter in that call. Removed it
and the one place where it was being non-functionally called.
Art Cancro [Thu, 21 Mar 2024 21:49:36 +0000 (14:49 -0700)]
Defined 19010101T010101Z-99991231T235959Z consts.
These are now known as "the_beginning_of_time" and
"the_end_of_time" and closely track the time boundaries within
which libical can safely operate.
Supplied these as default values when filling variables to call the
time range compare function, allowing us to remove the check-for-null
code in that function.
Art Cancro [Thu, 21 Mar 2024 18:30:29 +0000 (11:30 -0700)]
Do not convert compared times to UTC.
ical_ctdl_is_overlap() works because icaltime_compare() is really smart.
It looks at the time zone of the dtstart/dtend and can apparently go back up the icalcomponent
hierarchy to find its time zone data. I tested this by creating an event with a fictional
time zone and it did the right thing. It even showed the fictional name to me. This saves us
from having to convert everything to UTC before comparing. Nice!
Art Cancro [Wed, 20 Mar 2024 19:56:01 +0000 (15:56 -0400)]
ical_ctdl_is_overlap() is now symlinked 3 places.
It's the same function used in Citadel Server, WebCit-Classic, and
WebCit-NG. It isn't really suitable for use in libcitadel so we
made symlinks instead.
Art Cancro [Tue, 27 Feb 2024 16:16:56 +0000 (11:16 -0500)]
Skeleton code for time-range test (section 9.9)
After finally getting to the point where we are recursing up
through both the nested components and the nested queries in a
way that matches them properly, we are now able to start writing
the individual property and parameter queries defined in the RFC.
time-range (section 9.9) is the obvious first choice to implement
because it is the most useful. Wrote and bound the skeleton
function to do this.
Art Cancro [Thu, 22 Feb 2024 01:56:43 +0000 (20:56 -0500)]
Completed the first two filter tests.
comp-filter on the root element are the first two tests. Yes, these
are ridiculously easy, but hopefully it gets the design pattern started
and we can move on from there.
Art Cancro [Wed, 21 Feb 2024 17:28:11 +0000 (12:28 -0500)]
Try new strategy for CalDAV report filter parsing.
The recursive strategy I initially built looked clever but it's
not going to work because we need to iterate through both the
rules and the components/properties/parameters at the same time.
Reworked the code to go through filters iteratively instead of
recursively. This protocol is way too complex and the people who
designed it need to be tortured.
Art Cancro [Tue, 20 Feb 2024 15:15:57 +0000 (10:15 -0500)]
Skeleton code for filters.
All of the filters specified in RFC4971 9.7.1 through 9.7.5 will
be handled in this loop: comp-filter, prop-filter, param-filter,
is-not-defined, text-match, and probably others as we complete the
spec.
Also, in all of the .c files I unwrapped the license declaration onto a single
line, since the whole thing fits inside 132 characters, and 132 characters is
our official line length now.
Art Cancro [Wed, 14 Feb 2024 17:03:02 +0000 (12:03 -0500)]
Filters defined in RFC4791 9.7.1-9.7.5: DRY ingest
The code to parse these XML stanzas and ingest them into our filter
list was getting quite redundant. This commit abstracts them into
a single handler.
Art Cancro [Tue, 13 Feb 2024 22:31:28 +0000 (17:31 -0500)]
Yet another attempted framework for caldav filters.
CalDAV is stupid, the people who created it are stupid, and anyone who
still thinks it was a good idea are stupid. But now we're stuck with it
and I have to implement it.
Art Cancro [Mon, 12 Feb 2024 19:41:12 +0000 (14:41 -0500)]
Final changes to XML parser trace logging.
This is extremely inefficient code, but it will be ifdef'ed out
during normal use. Like the rest of the protocol trace options,
they are only getting ifdef'ed into use while I am developing.
Art Cancro [Thu, 8 Feb 2024 19:39:59 +0000 (14:39 -0500)]
Unified multistatus output for all REPORT outputs.
"multiget" and "query" REPORTs now use the same code path for
outputing results in DAV "multi-status" format, keeping this logic
DRY.
"query" reports are currently operating through a vile sleazy hack
that makes it output every item in the calendar without applying
any filters. That's the next piece to work on.
Art Cancro [Tue, 6 Feb 2024 03:41:52 +0000 (17:41 -1000)]
Added context state to output of RWHO command.
Hopefully the next time some douchebag from out of town floods our
site with stuck-open MSA sessions, we can figure out why it isn't
unbinding or timing out.
Art Cancro [Mon, 5 Feb 2024 22:46:34 +0000 (17:46 -0500)]
Awesome sauce, read description below for details.
My 'ctdlload' operation kept failing because there were a few user
records dumped that had insane data in them. CtdlDecodeBase64() was
silently doing buffer overruns because it doesn't know the size of
the target buffer.
While noodling a workaround, I realized that you can pass the same
pointer to CtdlDecodeBase64() as both the source *and* target buffer.
This works because the decoded data pointer will ALWAYS be behind the
encoded data pointer. This allows a "decode-in-place" operation!
By performing a decode-in-place and then using safestrncpy() to copy
the results to the finitely-sized string buffer in the target struct,
we guarantee no buffer overruns. Valgrind no longer bitches about it
and the program does not crash.
Art Cancro [Wed, 31 Jan 2024 02:59:50 +0000 (21:59 -0500)]
Giving up on doing citserver-side REPORT parsing.
webcit and citserver are guaranteed to be on the same host now, and
performance over a unix domain socket is likely to approach that of
doing it the "hard" way anyway. So I pulled out all the crap I was
adding. It was making the data model very ugly.
Art Cancro [Tue, 30 Jan 2024 15:26:53 +0000 (10:26 -0500)]
CtdlCheckExpress() now accepts a session context.
This is an experiment in reducing the use of the "CC" macro
that appears everywhere in the server. Willi used to do a lot
of "struct CitContext *CCC = CC" but that still called the macro
once per function call and it added complexity to the code. This
method is the right way, actually passing the session context up
the stack like we do in WebCit-NG.
Art Cancro [Mon, 29 Jan 2024 03:23:03 +0000 (22:23 -0500)]
Changed the BIGMSGS semantics.
We now identify the memory location of the start of message body
during serialization, so we don't have to measure it twice. Then
we store the body in the BIGMSGS table only if the total message
size would exceed 4000 bytes. This assumes that memory and disk
pages are 4096 bytes, so we want to optimize for a single I/O
operation in most cases.
Art Cancro [Fri, 26 Jan 2024 21:51:39 +0000 (16:51 -0500)]
Assert that eMessageText MUST be serialized last.
Also assert that the calculated length of the serialized message
is actually the final length. Either of these conditions not
being true is worth crashing the server so the developer who broke
it knows immediately.
Art Cancro [Wed, 24 Jan 2024 20:19:57 +0000 (10:19 -1000)]
Began refactoring CALDAV REPORT flow of control.
Removed calendar_functions.c and brought some of its code over
to caldav_reports.c so that we can use the same code path for all
three types of REPORTs.
This is motivated by an idea that perhaps the user interface can
use CalDAV as its REST API instead of inventing something new. If
that doesn't work, we needed to finish CalDAV eventually anyway.
Art Cancro [Mon, 8 Jan 2024 15:19:58 +0000 (10:19 -0500)]
START_CHAT_MODE is renamed to SEND_THEN_RECV
This protocol mode began almost 30 years ago when we handled real time chat by
holding a session open and moving data back and forth until told to stop. We
don't do that anymore, but there are several places where a command requires
sending long data in both directions. SEND_THEN_RECV is a better name for this.
Art Cancro [Fri, 5 Jan 2024 19:52:10 +0000 (14:52 -0500)]
That about wraps it up for serv_calendar.c
Seeing this code has really brought me back to the upstairs room
in my old house where I wrote most of it back in 2002-2003. I can
see the sunlight coming in the windows, the color of the carpet,
the little alcove where the computer was, the cat sleeping on top
of the big CRT monitor.
Hopefully the stuff I need to add to it now will be straightforward
since it looks like I really took my time and commented it heavily.
It looks pretty clean, especially now that I've reformatted it with
the new screen width an C99 comments. It does seem a bit WET though.
Art Cancro [Thu, 4 Jan 2024 22:51:08 +0000 (17:51 -0500)]
dammit, learn to spell
Many years ago, someone inserted an enum called eMesageText into the code
and used it all over the place without correcting the spelling. This
commit finally fixes it.
Art Cancro [Thu, 4 Jan 2024 22:47:35 +0000 (17:47 -0500)]
serv_calendar.c: basically reformatting for modern standards
When I wrote this stuff I had a 109 column screen. Now our standard
is 132 columns. Also we are seeking and destroying any place where
spaces were used as indentation. Our code is indented with tabs, the
way God intended.
Art Cancro [Thu, 4 Jan 2024 22:44:14 +0000 (17:44 -0500)]
serv_calendar.c: basically reformatting for modern standards
When I wrote this stuff I had a 109 column screen. Now our standard
is 132 columns. Also we are seeking and destroying any place where
spaces were used as indentation. Our code is indented with tabs, the
way God intended.