Thibault Godouet [Sat, 24 Aug 2024 22:40:44 +0000 (23:40 +0100)]
Rename config key displayname to maildisplayname, and refactor. (#33)
The main changes are:
- rename the fcron.conf config key displayname into maildisplayname, for clarity.
- move the underlying code into its own mail.c file, with some refactoring to improve clarity and simplify slightly.
- extend the extra overflow tests to test at the limit, and just over the limit (expecting an overflow error)
- ensure things work on systems which don't have stdbool.h (which is C99)
Full commit list:
* fix compilation error (couldn't find selinux.h)
* Rename boolean variable names.
* Check for stdbool.h's availability.
* Refactor maildisplayname.
* Move format_displayname() and make_mailbox_addr() into their own file.
* Ignore test binary.
* Rename option displayname to maildisplayname.
Signed-off-by: Marco Emilio "sphakka" Poleggi <7766137+sphakka@users.noreply.github.com>
* dev(code, doc, test): displayname handling refactored over two functions.
* code: config handling of displayname moved to a new function
'format_displayname()' in 'fcronconf.c'; buffer overflow check added. In
'job.c': restored old "From:" mail header behavior if no displayname; buffer
overflow check added.
* test: added prototype support in 'Makefile' and 'test/'
* doc: reviewed and cleaned 'en/fcron.conf.5.sgml'
* Makefile(s): fixed alignement with spaces
* config.in: moved displayname in "Check for fcron..." section. Removed test
install code.
* fcronconf.c: changed format_displayname()'s arg to avoid confusion with
globals. Use stdbool. Use aux var when assigning from
format_displayname().
* crondyn_svr.c, fileconf.c: minimal fixes to avoid conflict with stdbool.
* fcron.conf.in: added comment for possible displayname's future default value.
* global.h: added stdbool.
* job.c: changed make_mailbox_addr()'s arg to avoid confusion with
globals. Use stdbool.
* test/mailbox_addr.c: rewritten with simpler explicit logic -- valgrinded
again ;-)
Signed-off-by: Marco Emilio "sphakka" Poleggi <7766137+sphakka@users.noreply.github.com>
---------
Signed-off-by: Marco Emilio "sphakka" Poleggi <7766137+sphakka@users.noreply.github.com>
Add LICENSE at the root of the repository to make things clearer.
The license was already present under doc/ (e.g. doc/en/gpl.html) and mentioned at the top of each file of code, but having a license file in the root directory will make it clearer.
atlant2011 [Mon, 9 Aug 2021 17:12:18 +0000 (00:12 +0700)]
remove old link to header selinux/flask.h and selinux/av_permissions.h and depend (#12)
* 1. remove link to header selinux/flask.h and selinux/av_permissions.h
2. simple move from constant's SECCLASS_FILE and FILE__ENTRYPOINT to functions string_to_security_class("file") and string_to_av_perm(tclass, "entrypoint")
3. NEED CHECK CORRECT RETURN AFTER FAILED RETURN FROM FUNCTION string_to_security_class ADN string_to_av_perm !
Link to info from libselinux
https://github.com/SELinuxProject/selinux/commit/76913d8adb61b5#diff-046564229793ada24798dac3d2e479f07651ac9020d43938f3aa1fa9c9c24c9e
* read_conf() selinux: renamed vars and added error return
Eli Schwartz [Sun, 19 Apr 2020 08:36:22 +0000 (04:36 -0400)]
build: install programs as owner rw (#3)
Principle of least privilege suggests that for security-relevant
programs, no permissions other than those strictly necessary should be
applied. Hence the historic permissions for fcron were "executable, and
that's it". However, this causes problems for some legitimate use cases,
such as analysis of soname dependencies via readelf, use of strip, etc.
Slightly relax the install permissions to grant the owner, at least, rw
permissions. The owner can already trivially obtain these permissions at
will using chown, this merely saves them the bother.
Thibault Godouet [Sun, 12 Jun 2016 09:32:03 +0000 (10:32 +0100)]
refactored socket.[ch] into select.[ch] and fcrondyn_srv.[ch]
This is to prepare for getting notifed of time changes via timerfd_create() and select ()
Fixed occasional 1s slippage. Disable fcrondyn if we don't have gettimeofday() (or it won't work anyway)
This was due to a race condition between when time_to_sleep is run and when we compute how long to sleep for, which could happen in the following second: if that happened we end up sleeping for 1s instead of not sleeping at all. The fix was to replace time_to_sleep() by next_wake_time().