summaryrefslogtreecommitdiff
path: root/sfeed_mbox.c
AgeCommit message (Collapse)Author
2023-04-13atom, json, mbox: fix reading past the buffer with an escaped NUL byte (\ NUL)Hiltjo Posthuma
This would skip checking the end of the string of checking a NUL byte, because the iteration was done before checking it. It would proceed into the data that comes after. Note that sfeed itself can't generate such malformed data itself. Example input: 0 title link content\ html Would incorrect print "contenthtml" as the content.
2023-04-10remove sfeed "branding" in outputsHiltjo Posthuma
Technically for sfeed_atom this violates the RFC standard. There must be an author in the feed or for an item. However sfeed is not the author, it is a generator. All readers will read these feeds anyway. https://www.rfc-editor.org/rfc/rfc4287#section-4.1.1 "atom:feed elements MUST contain one or more atom:author elements, unless all of the atom:feed element's child atom:entry elements contain at least one atom:author element." *shrug*
2022-07-20slightly improve some commentsHiltjo Posthuma
2022-03-20check write errors on the output stream after each feedHiltjo Posthuma
This will detect write errors sooner.
2022-03-15stricter error checking in file streams (input, output)Hiltjo Posthuma
This also makes the programs exit with a non-zero status when a read or write error occurs. This makes checking the exit status more reliable in scripts. A simple example to simulate a disk with no space left: curl -s 'https://codemadness.org/atom.xml' | sfeed > f /mnt/test: write failed, file system is full echo $? 0 Which now produces: curl -s 'https://codemadness.org/atom.xml' | sfeed > f /mnt/test: write failed, file system is full write error: <stdout> echo $? 1 Tested with a small mfs on OpenBSD, fstab entry: swap /mnt/test mfs rw,nodev,nosuid,-s=1M 0 0
2022-03-14improve time(NULL) error checkingHiltjo Posthuma
Use errx, time(NULL) does not set errno. For sfeed_curses reset errno so it doesn't print a random error if it failed. POSIX recommends checking against (time_t)-1 on failure. Note that some implementation, like the OpenBSD man page says time() cannot fail.
2022-02-24sfeed_mbox: use putc, it may be implemented as a macroHiltjo Posthuma
No functional difference intended.
2021-11-24sfeed_mbox: escape the link and enclosure text when using HTML contentHiltjo Posthuma
commit ed8079dc3e8ce513c788a5ab11444aac221cbc5b added an option $SFEED_MBOX_CONTENT with a content-type text/html to include the content. However in this context the link and enclosure were not fully escaped.
2021-10-25sfeed_mbox: add link as base URL for HTML contentHiltjo Posthuma
This is useful for HTML viewers (like lynx -dump) in mail clients to use the base href as the base URL for relative links in the HTML content.
2021-10-25sfeed_mbox: use 64-bit for the checksum numberHiltjo Posthuma
This makes the checksum number atleast 64-bit and makes the Message-ID header consistent across mixed 32-bit and 64-bit systems. Tested on amd64 and MIPS32BE.
2021-08-03code-style: use a newline before return in main()Hiltjo Posthuma
2021-07-19code-style: change gmtime to the reentrant/thread-safe gmtime_rHiltjo Posthuma
No functional or performance difference (intended) because these programs are not threaded.
2021-07-06sfeed_mbox: add option to print contentHiltjo Posthuma
- Add SFEED_MBOX_CONTENT environment option. When set to "1" it outputs the content aswell. This is disabled by default for security reasons, because many clients handle HTML in an insecure way. - Print link and enclosure on one line and align them.
2021-06-01portability and standards: add BSD-like err() and errx() functionsHiltjo Posthuma
These are BSD functions. - HaikuOS now compiles without having to use libbsd. - Tested on SerenityOS (for fun), which doesn't have these functions (yet). With a small change to support wcwidth() sfeed works on SerenityOS.
2020-07-05sfeed_mbox: don't ignore items with a missing/invalid timestampHiltjo Posthuma
The Date header is mandatory. Use the current time if it is missing/invalid.
2020-04-27sfeed_mbox: fallback author to feedname, not "unknown"Hiltjo Posthuma
For the author "unknown" is not a good indicator. Just fallback to the feedname if the exact author of the feed item is not known/set by the feed.
2020-04-27sfeed_mbox: remove prefix in subjectHiltjo Posthuma
The prefix in the subject can be too much/redundant if custom labels are used in the mail client for example. Filtering or custom labels can be made using the X-Feedname header. For mutt it can be useful to use the header X-Label and use the %y format specified to indicate the label. The index_format is described in the muttrc man page. An example: set index_format = "%4C %Z %[%a, %b %d %H:%M] %?y?%-15.15y ?%-15.15L (%?l?%4l&%4c?) %s" Other programs have similar headers: Dovecat has "X-Keywords" and Thunderbird "X-Mozilla-Keys".
2020-04-01util: improve/cleanup parseline()Hiltjo Posthuma
- remove a check that has no use/can never happen. - remove the return value as it's unused and the input size is known. - fix an old comment that doesn't reflect what the function does anymore.
2020-03-15sfeed_mbox: time parsing and consistency fixesHiltjo Posthuma
- make converting time error out as the other format tools do also. - remove wrong comment. - make code-style consistent.
2020-03-15sfeed_mbox: POSIX defines gmtime_r sets errno, so use err(), not errx()Hiltjo Posthuma
2020-01-24cleanup some includesHiltjo Posthuma
2019-04-25sfeed_mbox: use simpler djb2 hash, fix message-id as intendedHiltjo Posthuma
The message-id has not been working as intended for a while. It only hashed the timestamp field because parseline() modifies the buffer in-place.
2019-04-21sfeed_mbox: show enclosure url when it is non-emptyHiltjo Posthuma
2018-11-04whitespace and comment fixHiltjo Posthuma
2018-10-08sfeed_mbox: remove an unneeded strlcpy callHiltjo Posthuma
2018-10-08sfeed_mbox: add seconds to Date headerHiltjo Posthuma
2018-08-23sfeed_mbox: improvementsHiltjo Posthuma
- don't output content and HTML mail anymore: this is very insecure for most mail clients. - improve Content-Type utf-8 encoding header (use the more common form). - improve line-endings at the end of the data.
2017-12-24sfeed_mbox: make murmur3_32 staticHiltjo Posthuma
2017-12-24format programs: ignore fields with an invalid timeHiltjo Posthuma
this makes sure tail -f with multiple files ignores the ==> file <== lines too.
2017-12-09sfeed_mbox: move murmur to this file, cleanupHiltjo Posthuma
2017-04-27simplify pledge stubHiltjo Posthuma
2017-04-27sfeed_mbox: remove redundant conditionHiltjo Posthuma
2016-08-06add USE_PLEDGE, remove pledge dummy functionHiltjo Posthuma
2016-04-10remove basename, just use last part of the path...Hiltjo Posthuma
... as a bonus it also saves an allocation.
2016-02-28use prime as seed for murmur3 seed (doesnt matter much)Hiltjo Posthuma
2016-02-28null-terminate line at newline from getline()Hiltjo Posthuma
2016-02-27various improvementsHiltjo Posthuma
- pledge tools and add define to enable it on platforms that support it, currently only OpenBSD 5.9+ - separate getline and parseline functionality. - use murmur3 hash instead of jenkins1: faster and less collisions. - make some error messages a bit more clear, for example with path truncation. - some small cleanups, move printutf8pad to util.
2015-10-05sfeed_mbox: do host lookup and current time once at startup, not per feedHiltjo Posthuma
2015-10-04sfeed_mbox: small cleanup, move label so check for NUL isnt neededHiltjo Posthuma
2015-10-04portability: dont use HOST_NAME_MAX, just use 256 as maximumHiltjo Posthuma
2015-08-23sfeed_mbox: clarify format time error (strftime)Hiltjo Posthuma
2015-08-16code-style + no need to zero static variablesHiltjo Posthuma
2015-08-16code-style, wrap some lines, etcHiltjo Posthuma
2015-08-08sfeed_mbox: use feedname in message-idHiltjo Posthuma
2015-08-07util: strtotime: stricter time parsingHiltjo Posthuma
as input: an empty string or non-digit characters are digits are considered an error now. Still, for the format tools output the formatted time string as time_t 0 on a parse error.
2015-08-07sfeed_mbox: use simple hash for Message-IdHiltjo Posthuma
2015-08-05sfeed_mbox: combine date check conditionHiltjo Posthuma
2015-08-02util: simplify parseline() and check t for strtotime().Hiltjo Posthuma
2015-08-02sfeed_mbox: improvementsHiltjo Posthuma
- don't xmlencode HTML, show as is. - mangle "From " mboxrd-style. Content-Length would be cleaner but would require extra buffering.
2015-08-01sfeed_mbox: xmlencode link for HTML mail, simplify a bitHiltjo Posthuma