s6

Mirror/fork of https://skarnet.org/software/s6/
git clone https://ccx.te2000.cz/git/s6
Log | Files | Refs | README | LICENSE

commit e62d3ae45e9bf3b97551b8879bf6c441ff961ec1
parent 2c922d2f9870ef174894a6b91399d5cd59318352
Author: Laurent Bercot <ska-skaware@skarnet.org>
Date:   Fri, 23 Jan 2015 16:07:31 +0000

 - add s6_accessrules_params_free
 - some libfdholder debug

Diffstat:
Mpackage/deps.mak | 48+++++++++++++++++++++++++++++++++++++++++++++---
Msrc/conn-tools/s6-sudo.c | 2+-
Msrc/include/s6/accessrules.h | 2++
Msrc/include/s6/s6-fdholder.h | 12++++++------
Msrc/libs6/deps-lib/s6 | 1+
Asrc/libs6/s6_accessrules_params_free.c | 10++++++++++
Msrc/libs6/s6_fdholder_delete.c | 3++-
Msrc/libs6/s6_fdholder_getdump.c | 5+++--
Msrc/libs6/s6_fdholder_list.c | 3++-
Msrc/libs6/s6_fdholder_list_cb.c | 2++
Msrc/libs6/s6_fdholder_retrieve.c | 3++-
Msrc/libs6/s6_fdholder_setdump.c | 5+++--
Msrc/libs6/s6_fdholder_store.c | 3++-
13 files changed, 81 insertions(+), 18 deletions(-)

diff --git a/package/deps.mak b/package/deps.mak @@ -8,7 +8,6 @@ src/include/s6/s6lock.h: src/include/s6/config.h src/conn-tools/s6-accessrules-cdb-from-fs.o src/conn-tools/s6-accessrules-cdb-from-fs.lo: src/conn-tools/s6-accessrules-cdb-from-fs.c src/conn-tools/s6-accessrules-fs-from-cdb.o src/conn-tools/s6-accessrules-fs-from-cdb.lo: src/conn-tools/s6-accessrules-fs-from-cdb.c src/conn-tools/s6-connlimit.o src/conn-tools/s6-connlimit.lo: src/conn-tools/s6-connlimit.c -src/conn-tools/s6-fdholderd.o src/conn-tools/s6-fdholderd.lo: src/conn-tools/s6-fdholderd.c src/include/s6/accessrules.h src/include/s6/s6-fdholder.h src/conn-tools/s6-ioconnect.o src/conn-tools/s6-ioconnect.lo: src/conn-tools/s6-ioconnect.c src/conn-tools/s6-ipcclient.o src/conn-tools/s6-ipcclient.lo: src/conn-tools/s6-ipcclient.c src/conn-tools/s6-ipcserver-access.o src/conn-tools/s6-ipcserver-access.lo: src/conn-tools/s6-ipcserver-access.c src/include/s6/accessrules.h @@ -30,6 +29,20 @@ src/daemontools-extras/s6-softlimit.o src/daemontools-extras/s6-softlimit.lo: sr src/daemontools-extras/s6-tai64n.o src/daemontools-extras/s6-tai64n.lo: src/daemontools-extras/s6-tai64n.c src/daemontools-extras/s6-tai64nlocal.o src/daemontools-extras/s6-tai64nlocal.lo: src/daemontools-extras/s6-tai64nlocal.c src/daemontools-extras/ucspilogd.o src/daemontools-extras/ucspilogd.lo: src/daemontools-extras/ucspilogd.c +src/fdholder/s6-fdholder-daemon.o src/fdholder/s6-fdholder-daemon.lo: src/fdholder/s6-fdholder-daemon.c src/include/s6/config.h +src/fdholder/s6-fdholder-getdump.o src/fdholder/s6-fdholder-getdump.lo: src/fdholder/s6-fdholder-getdump.c src/include/s6/config.h +src/fdholder/s6-fdholder-getdumpc.o src/fdholder/s6-fdholder-getdumpc.lo: src/fdholder/s6-fdholder-getdumpc.c src/include/s6/s6-fdholder.h +src/fdholder/s6-fdholder-list.o src/fdholder/s6-fdholder-list.lo: src/fdholder/s6-fdholder-list.c src/include/s6/config.h +src/fdholder/s6-fdholder-listc.o src/fdholder/s6-fdholder-listc.lo: src/fdholder/s6-fdholder-listc.c src/include/s6/s6-fdholder.h +src/fdholder/s6-fdholder-retrieve.o src/fdholder/s6-fdholder-retrieve.lo: src/fdholder/s6-fdholder-retrieve.c src/include/s6/config.h +src/fdholder/s6-fdholder-retrievec.o src/fdholder/s6-fdholder-retrievec.lo: src/fdholder/s6-fdholder-retrievec.c src/include/s6/s6-fdholder.h +src/fdholder/s6-fdholder-setdump.o src/fdholder/s6-fdholder-setdump.lo: src/fdholder/s6-fdholder-setdump.c src/include/s6/config.h +src/fdholder/s6-fdholder-setdumpc.o src/fdholder/s6-fdholder-setdumpc.lo: src/fdholder/s6-fdholder-setdumpc.c src/include/s6/s6-fdholder.h +src/fdholder/s6-fdholder-store.o src/fdholder/s6-fdholder-store.lo: src/fdholder/s6-fdholder-store.c src/include/s6/config.h +src/fdholder/s6-fdholder-storec.o src/fdholder/s6-fdholder-storec.lo: src/fdholder/s6-fdholder-storec.c src/include/s6/s6-fdholder.h +src/fdholder/s6-fdholder-transferdump.o src/fdholder/s6-fdholder-transferdump.lo: src/fdholder/s6-fdholder-transferdump.c src/include/s6/config.h +src/fdholder/s6-fdholder-transferdumpc.o src/fdholder/s6-fdholder-transferdumpc.lo: src/fdholder/s6-fdholder-transferdumpc.c src/include/s6/s6-fdholder.h +src/fdholder/s6-fdholderd.o src/fdholder/s6-fdholderd.lo: src/fdholder/s6-fdholderd.c src/include/s6/accessrules.h src/include/s6/s6-fdholder.h src/libs6/ftrig1_free.o src/libs6/ftrig1_free.lo: src/libs6/ftrig1_free.c src/libs6/ftrig1.h src/libs6/ftrig1_make.o src/libs6/ftrig1_make.lo: src/libs6/ftrig1_make.c src/libs6/ftrig1.h src/libs6/ftrigr1_zero.o src/libs6/ftrigr1_zero.lo: src/libs6/ftrigr1_zero.c src/include/s6/ftrigr.h @@ -55,6 +68,7 @@ src/libs6/s6_accessrules_keycheck_ip4.o src/libs6/s6_accessrules_keycheck_ip4.lo src/libs6/s6_accessrules_keycheck_ip6.o src/libs6/s6_accessrules_keycheck_ip6.lo: src/libs6/s6_accessrules_keycheck_ip6.c src/include/s6/accessrules.h src/libs6/s6_accessrules_keycheck_reversedns.o src/libs6/s6_accessrules_keycheck_reversedns.lo: src/libs6/s6_accessrules_keycheck_reversedns.c src/include/s6/accessrules.h src/libs6/s6_accessrules_keycheck_uidgid.o src/libs6/s6_accessrules_keycheck_uidgid.lo: src/libs6/s6_accessrules_keycheck_uidgid.c src/include/s6/accessrules.h +src/libs6/s6_accessrules_params_free.o src/libs6/s6_accessrules_params_free.lo: src/libs6/s6_accessrules_params_free.c src/include/s6/accessrules.h src/libs6/s6_accessrules_uidgid_cdb.o src/libs6/s6_accessrules_uidgid_cdb.lo: src/libs6/s6_accessrules_uidgid_cdb.c src/include/s6/accessrules.h src/libs6/s6_accessrules_uidgid_fs.o src/libs6/s6_accessrules_uidgid_fs.lo: src/libs6/s6_accessrules_uidgid_fs.c src/include/s6/accessrules.h src/libs6/s6_fdholder_delete.o src/libs6/s6_fdholder_delete.lo: src/libs6/s6_fdholder_delete.c src/include/s6/s6-fdholder.h @@ -153,8 +167,36 @@ s6-tai64nlocal: private EXTRA_LIBS := s6-tai64nlocal: src/daemontools-extras/s6-tai64nlocal.o -lskarnet ucspilogd: private EXTRA_LIBS := ucspilogd: src/daemontools-extras/ucspilogd.o -lskarnet -libs6.a: src/libs6/ftrigr1_zero.o src/libs6/ftrigr_check.o src/libs6/ftrigr_end.o src/libs6/ftrigr_start.o src/libs6/ftrigr_startf.o src/libs6/ftrigr_subscribe.o src/libs6/ftrigr_unsubscribe.o src/libs6/ftrigr_update.o src/libs6/ftrigr_wait_and.o src/libs6/ftrigr_wait_or.o src/libs6/ftrigr_zero.o src/libs6/ftrigw_clean.o src/libs6/ftrigw_fifodir_make.o src/libs6/ftrigw_notify.o src/libs6/ftrigw_notifyb.o src/libs6/ftrigw_notifyb_nosig.o src/libs6/s6_accessrules_backend_cdb.o src/libs6/s6_accessrules_backend_fs.o src/libs6/s6_accessrules_keycheck_ip4.o src/libs6/s6_accessrules_keycheck_ip6.o src/libs6/s6_accessrules_keycheck_reversedns.o src/libs6/s6_accessrules_keycheck_uidgid.o src/libs6/s6_accessrules_uidgid_cdb.o src/libs6/s6_accessrules_uidgid_fs.o src/libs6/s6_supervise_lock.o src/libs6/s6_supervise_lock_mode.o src/libs6/s6_svc_write.o src/libs6/s6_svstatus_pack.o src/libs6/s6_svstatus_read.o src/libs6/s6_svstatus_unpack.o src/libs6/s6_svstatus_write.o src/libs6/s6lock_acquire.o src/libs6/s6lock_check.o src/libs6/s6lock_end.o src/libs6/s6lock_release.o src/libs6/s6lock_start.o src/libs6/s6lock_startf.o src/libs6/s6lock_update.o src/libs6/s6lock_wait_and.o src/libs6/s6lock_wait_or.o src/libs6/s6lock_zero.o src/libs6/s6_fdholder_delete.o src/libs6/s6_fdholder_delete_async.o src/libs6/s6_fdholder_getdump.o src/libs6/s6_fdholder_list.o src/libs6/s6_fdholder_list_async.o src/libs6/s6_fdholder_list_cb.o src/libs6/s6_fdholder_retrieve.o src/libs6/s6_fdholder_retrieve_async.o src/libs6/s6_fdholder_retrieve_cb.o src/libs6/s6_fdholder_setdump.o src/libs6/s6_fdholder_store.o src/libs6/s6_fdholder_store_async.o -libs6.so: src/libs6/ftrigr1_zero.lo src/libs6/ftrigr_check.lo src/libs6/ftrigr_end.lo src/libs6/ftrigr_start.lo src/libs6/ftrigr_startf.lo src/libs6/ftrigr_subscribe.lo src/libs6/ftrigr_unsubscribe.lo src/libs6/ftrigr_update.lo src/libs6/ftrigr_wait_and.lo src/libs6/ftrigr_wait_or.lo src/libs6/ftrigr_zero.lo src/libs6/ftrigw_clean.lo src/libs6/ftrigw_fifodir_make.lo src/libs6/ftrigw_notify.lo src/libs6/ftrigw_notifyb.lo src/libs6/ftrigw_notifyb_nosig.lo src/libs6/s6_accessrules_backend_cdb.lo src/libs6/s6_accessrules_backend_fs.lo src/libs6/s6_accessrules_keycheck_ip4.lo src/libs6/s6_accessrules_keycheck_ip6.lo src/libs6/s6_accessrules_keycheck_reversedns.lo src/libs6/s6_accessrules_keycheck_uidgid.lo src/libs6/s6_accessrules_uidgid_cdb.lo src/libs6/s6_accessrules_uidgid_fs.lo src/libs6/s6_supervise_lock.lo src/libs6/s6_supervise_lock_mode.lo src/libs6/s6_svc_write.lo src/libs6/s6_svstatus_pack.lo src/libs6/s6_svstatus_read.lo src/libs6/s6_svstatus_unpack.lo src/libs6/s6_svstatus_write.lo src/libs6/s6lock_acquire.lo src/libs6/s6lock_check.lo src/libs6/s6lock_end.lo src/libs6/s6lock_release.lo src/libs6/s6lock_start.lo src/libs6/s6lock_startf.lo src/libs6/s6lock_update.lo src/libs6/s6lock_wait_and.lo src/libs6/s6lock_wait_or.lo src/libs6/s6lock_zero.lo src/libs6/s6_fdholder_delete.lo src/libs6/s6_fdholder_delete_async.lo src/libs6/s6_fdholder_getdump.lo src/libs6/s6_fdholder_list.lo src/libs6/s6_fdholder_list_async.lo src/libs6/s6_fdholder_list_cb.lo src/libs6/s6_fdholder_retrieve.lo src/libs6/s6_fdholder_retrieve_async.lo src/libs6/s6_fdholder_retrieve_cb.lo src/libs6/s6_fdholder_setdump.lo src/libs6/s6_fdholder_store.lo src/libs6/s6_fdholder_store_async.lo +s6-fdholder-daemon: private EXTRA_LIBS := +s6-fdholder-daemon: src/fdholder/s6-fdholder-daemon.o -lskarnet +s6-fdholder-getdump: private EXTRA_LIBS := +s6-fdholder-getdump: src/fdholder/s6-fdholder-getdump.o -lskarnet +s6-fdholder-getdumpc: private EXTRA_LIBS := ${SOCKET_LIB} ${TAINNOW_LIB} +s6-fdholder-getdumpc: src/fdholder/s6-fdholder-getdumpc.o ${LIBS6} -lskarnet +s6-fdholder-list: private EXTRA_LIBS := +s6-fdholder-list: src/fdholder/s6-fdholder-list.o -lskarnet +s6-fdholder-listc: private EXTRA_LIBS := ${SOCKET_LIB} ${TAINNOW_LIB} +s6-fdholder-listc: src/fdholder/s6-fdholder-listc.o ${LIBS6} -lskarnet +s6-fdholder-retrieve: private EXTRA_LIBS := +s6-fdholder-retrieve: src/fdholder/s6-fdholder-retrieve.o -lskarnet +s6-fdholder-retrievec: private EXTRA_LIBS := ${SOCKET_LIB} ${TAINNOW_LIB} +s6-fdholder-retrievec: src/fdholder/s6-fdholder-retrievec.o ${LIBS6} -lskarnet +s6-fdholder-setdump: private EXTRA_LIBS := +s6-fdholder-setdump: src/fdholder/s6-fdholder-setdump.o -lskarnet +s6-fdholder-setdumpc: private EXTRA_LIBS := ${SOCKET_LIB} ${TAINNOW_LIB} +s6-fdholder-setdumpc: src/fdholder/s6-fdholder-setdumpc.o ${LIBS6} -lskarnet +s6-fdholder-store: private EXTRA_LIBS := +s6-fdholder-store: src/fdholder/s6-fdholder-store.o -lskarnet +s6-fdholder-storec: private EXTRA_LIBS := ${SOCKET_LIB} ${TAINNOW_LIB} +s6-fdholder-storec: src/fdholder/s6-fdholder-storec.o ${LIBS6} -lskarnet +s6-fdholder-transferdump: private EXTRA_LIBS := +s6-fdholder-transferdump: src/fdholder/s6-fdholder-transferdump.o -lskarnet +s6-fdholder-transferdumpc: private EXTRA_LIBS := ${SOCKET_LIB} ${TAINNOW_LIB} +s6-fdholder-transferdumpc: src/fdholder/s6-fdholder-transferdumpc.o ${LIBS6} -lskarnet +s6-fdholderd: private EXTRA_LIBS := ${SOCKET_LIB} ${TAINNOW_LIB} +s6-fdholderd: src/fdholder/s6-fdholderd.o ${LIBS6} -lskarnet +libs6.a: src/libs6/ftrigr1_zero.o src/libs6/ftrigr_check.o src/libs6/ftrigr_end.o src/libs6/ftrigr_start.o src/libs6/ftrigr_startf.o src/libs6/ftrigr_subscribe.o src/libs6/ftrigr_unsubscribe.o src/libs6/ftrigr_update.o src/libs6/ftrigr_wait_and.o src/libs6/ftrigr_wait_or.o src/libs6/ftrigr_zero.o src/libs6/ftrigw_clean.o src/libs6/ftrigw_fifodir_make.o src/libs6/ftrigw_notify.o src/libs6/ftrigw_notifyb.o src/libs6/ftrigw_notifyb_nosig.o src/libs6/s6_accessrules_backend_cdb.o src/libs6/s6_accessrules_backend_fs.o src/libs6/s6_accessrules_keycheck_ip4.o src/libs6/s6_accessrules_keycheck_ip6.o src/libs6/s6_accessrules_keycheck_reversedns.o src/libs6/s6_accessrules_keycheck_uidgid.o src/libs6/s6_accessrules_params_free.o src/libs6/s6_accessrules_uidgid_cdb.o src/libs6/s6_accessrules_uidgid_fs.o src/libs6/s6_supervise_lock.o src/libs6/s6_supervise_lock_mode.o src/libs6/s6_svc_write.o src/libs6/s6_svstatus_pack.o src/libs6/s6_svstatus_read.o src/libs6/s6_svstatus_unpack.o src/libs6/s6_svstatus_write.o src/libs6/s6lock_acquire.o src/libs6/s6lock_check.o src/libs6/s6lock_end.o src/libs6/s6lock_release.o src/libs6/s6lock_start.o src/libs6/s6lock_startf.o src/libs6/s6lock_update.o src/libs6/s6lock_wait_and.o src/libs6/s6lock_wait_or.o src/libs6/s6lock_zero.o src/libs6/s6_fdholder_delete.o src/libs6/s6_fdholder_delete_async.o src/libs6/s6_fdholder_getdump.o src/libs6/s6_fdholder_list.o src/libs6/s6_fdholder_list_async.o src/libs6/s6_fdholder_list_cb.o src/libs6/s6_fdholder_retrieve.o src/libs6/s6_fdholder_retrieve_async.o src/libs6/s6_fdholder_retrieve_cb.o src/libs6/s6_fdholder_setdump.o src/libs6/s6_fdholder_store.o src/libs6/s6_fdholder_store_async.o +libs6.so: src/libs6/ftrigr1_zero.lo src/libs6/ftrigr_check.lo src/libs6/ftrigr_end.lo src/libs6/ftrigr_start.lo src/libs6/ftrigr_startf.lo src/libs6/ftrigr_subscribe.lo src/libs6/ftrigr_unsubscribe.lo src/libs6/ftrigr_update.lo src/libs6/ftrigr_wait_and.lo src/libs6/ftrigr_wait_or.lo src/libs6/ftrigr_zero.lo src/libs6/ftrigw_clean.lo src/libs6/ftrigw_fifodir_make.lo src/libs6/ftrigw_notify.lo src/libs6/ftrigw_notifyb.lo src/libs6/ftrigw_notifyb_nosig.lo src/libs6/s6_accessrules_backend_cdb.lo src/libs6/s6_accessrules_backend_fs.lo src/libs6/s6_accessrules_keycheck_ip4.lo src/libs6/s6_accessrules_keycheck_ip6.lo src/libs6/s6_accessrules_keycheck_reversedns.lo src/libs6/s6_accessrules_keycheck_uidgid.lo src/libs6/s6_accessrules_params_free.lo src/libs6/s6_accessrules_uidgid_cdb.lo src/libs6/s6_accessrules_uidgid_fs.lo src/libs6/s6_supervise_lock.lo src/libs6/s6_supervise_lock_mode.lo src/libs6/s6_svc_write.lo src/libs6/s6_svstatus_pack.lo src/libs6/s6_svstatus_read.lo src/libs6/s6_svstatus_unpack.lo src/libs6/s6_svstatus_write.lo src/libs6/s6lock_acquire.lo src/libs6/s6lock_check.lo src/libs6/s6lock_end.lo src/libs6/s6lock_release.lo src/libs6/s6lock_start.lo src/libs6/s6lock_startf.lo src/libs6/s6lock_update.lo src/libs6/s6lock_wait_and.lo src/libs6/s6lock_wait_or.lo src/libs6/s6lock_zero.lo src/libs6/s6_fdholder_delete.lo src/libs6/s6_fdholder_delete_async.lo src/libs6/s6_fdholder_getdump.lo src/libs6/s6_fdholder_list.lo src/libs6/s6_fdholder_list_async.lo src/libs6/s6_fdholder_list_cb.lo src/libs6/s6_fdholder_retrieve.lo src/libs6/s6_fdholder_retrieve_async.lo src/libs6/s6_fdholder_retrieve_cb.lo src/libs6/s6_fdholder_setdump.lo src/libs6/s6_fdholder_store.lo src/libs6/s6_fdholder_store_async.lo s6-ftrigrd: private EXTRA_LIBS := ${SOCKET_LIB} ${TAINNOW_LIB} s6-ftrigrd: src/libs6/s6-ftrigrd.o src/libs6/ftrig1_free.o src/libs6/ftrig1_make.o -lskarnet s6lockd: private EXTRA_LIBS := ${SOCKET_LIB} ${TAINNOW_LIB} diff --git a/src/conn-tools/s6-sudo.c b/src/conn-tools/s6-sudo.c @@ -1,4 +1,4 @@ -/* ISC license. */ + /* ISC license. */ #include <skalibs/uint.h> #include <skalibs/sgetopt.h> diff --git a/src/include/s6/accessrules.h b/src/include/s6/accessrules.h @@ -15,6 +15,8 @@ struct s6_accessrules_params_s } ; #define S6_ACCESSRULES_PARAMS_ZERO { .env = STRALLOC_ZERO, .exec = STRALLOC_ZERO } +extern void s6_accessrules_params_free (s6_accessrules_params_t *) ; + typedef enum s6_accessrules_result_e s6_accessrules_result_t, *s6_accessrules_result_t_ref ; enum s6_accessrules_result_e { diff --git a/src/include/s6/s6-fdholder.h b/src/include/s6/s6-fdholder.h @@ -17,9 +17,9 @@ struct s6_fdholder_s { unixconnection_t connection ; } ; -#define S6_FDHOLDER_ZERO { .connection = UNIXMESSAGE_CONNECTION_ZERO } ; +#define S6_FDHOLDER_ZERO { .connection = UNIXCONNECTION_ZERO } ; -#define s6_fdholder_init(a, fdin, fdout) unixconnection_init(&(a)->connection, fdin, fdout) +#define s6_fdholder_init(a, fd) unixconnection_init(&(a)->connection, fd, fd) #define s6_fdholder_free(a) unixconnection_free(&(a)->connection) @@ -43,11 +43,11 @@ struct s6_fdholder_retrieve_result_s extern int s6_fdholder_retrieve_maybe_delete_async (s6_fdholder_t *, char const *, int) ; extern unixmessage_handler_func_t s6_fdholder_retrieve_cb ; extern int s6_fdholder_retrieve_maybe_delete (s6_fdholder_t *, char const *, int, tain_t const *, tain_t *) ; -#define s6_fdholder_retrieve_maybe_delete_g (a, id, h, deadline) s6_fdholder_retrieve(a, id, h, (deadline), &STAMP) +#define s6_fdholder_retrieve_maybe_delete_g(a, id, h, deadline) s6_fdholder_retrieve_maybe_delete(a, id, h, (deadline), &STAMP) #define s6_fdholder_retrieve(a, id, deadline, stamp) s6_fdholder_retrieve_maybe_delete(a, id, 0, deadline, stamp) -#define s6_fdholder_retrieve_g (a, id, deadline) s6_fdholder_retrieve(a, id, (deadline), &STAMP) +#define s6_fdholder_retrieve_g(a, id, deadline) s6_fdholder_retrieve(a, id, (deadline), &STAMP) #define s6_fdholder_retrieve_delete(a, id, deadline, stamp) s6_fdholder_retrieve_maybe_delete(a, id, 1, deadline, stamp) -#define s6_fdholder_retrieve_delete_g (a, id, deadline) s6_fdholder_retrieve(a, id, (deadline), &STAMP) +#define s6_fdholder_retrieve_delete_g(a, id, deadline) s6_fdholder_retrieve(a, id, (deadline), &STAMP) typedef struct s6_fdholder_list_result_s s6_fdholder_list_result_t, *s6_fdholder_list_result_t_ref ; struct s6_fdholder_list_result_s @@ -74,7 +74,7 @@ struct s6_fdholder_fd_s } ; extern int s6_fdholder_getdump (s6_fdholder_t *, genalloc *, tain_t const *, tain_t *) ; -#define s6_fdholder_getdump_g(a, g, deadline) s6_fdholder_getdump_g(a, g, (deadline), &STAMP) +#define s6_fdholder_getdump_g(a, g, deadline) s6_fdholder_getdump(a, g, (deadline), &STAMP) extern int s6_fdholder_setdump (s6_fdholder_t *, s6_fdholder_fd_t const *, unsigned int, tain_t const *, tain_t *) ; #define s6_fdholder_setdump_g(a, list, n, deadline) s6_fdholder_setdump(a, list, n, (deadline), &STAMP) diff --git a/src/libs6/deps-lib/s6 b/src/libs6/deps-lib/s6 @@ -20,6 +20,7 @@ s6_accessrules_keycheck_ip4.o s6_accessrules_keycheck_ip6.o s6_accessrules_keycheck_reversedns.o s6_accessrules_keycheck_uidgid.o +s6_accessrules_params_free.o s6_accessrules_uidgid_cdb.o s6_accessrules_uidgid_fs.o s6_supervise_lock.o diff --git a/src/libs6/s6_accessrules_params_free.c b/src/libs6/s6_accessrules_params_free.c @@ -0,0 +1,10 @@ +/* ISC license. */ + +#include <skalibs/stralloc.h> +#include <s6/accessrules.h> + +void s6_accessrules_params_free (s6_accessrules_params_t *params) +{ + stralloc_free(&params->env) ; + stralloc_free(&params->exec) ; +} diff --git a/src/libs6/s6_fdholder_delete.c b/src/libs6/s6_fdholder_delete.c @@ -1,6 +1,7 @@ /* ISC license. */ #include <errno.h> +#include <skalibs/allreadwrite.h> #include <skalibs/error.h> #include <skalibs/tai.h> #include <skalibs/unixmessage.h> @@ -11,7 +12,7 @@ int s6_fdholder_delete (s6_fdholder_t *a, char const *id, tain_t const *deadline unixmessage_t m ; if (!s6_fdholder_delete_async(a, id)) return 0 ; if (!unixmessage_sender_timed_flush(&a->connection.out, deadline, stamp)) return 0 ; - if (!unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) return 0 ; + if (sanitize_read(unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) < 0) return 0 ; if (m.len != 1 || m.nfds) { unixmessage_drop(&m) ; diff --git a/src/libs6/s6_fdholder_getdump.c b/src/libs6/s6_fdholder_getdump.c @@ -2,6 +2,7 @@ #include <errno.h> #include <skalibs/uint32.h> +#include <skalibs/allreadwrite.h> #include <skalibs/error.h> #include <skalibs/bytestr.h> #include <skalibs/tai.h> @@ -19,7 +20,7 @@ int s6_fdholder_getdump (s6_fdholder_t *a, genalloc *g, tain_t const *deadline, int ok ; if (!unixmessage_put(&a->connection.out, &m)) return 0 ; if (!unixmessage_sender_timed_flush(&a->connection.out, deadline, stamp)) return 0 ; - if (!unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) return 0 ; + if (sanitize_read(unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) < 0) return 0 ; if (!m.len || m.nfds) return (errno = EPROTO, 0) ; if (m.s[0]) return (errno = m.s[0], 0) ; if (m.len != 9) return (errno = EPROTO, 0) ; @@ -31,7 +32,7 @@ int s6_fdholder_getdump (s6_fdholder_t *a, genalloc *g, tain_t const *deadline, for (; i < n ; i++) { - if (!unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) goto err ; + if (sanitize_read(unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) < 0) goto err ; if (genalloc_len(s6_fdholder_fd_t, g) + m.nfds > ntot) goto droperr ; if (ok) { diff --git a/src/libs6/s6_fdholder_list.c b/src/libs6/s6_fdholder_list.c @@ -1,6 +1,7 @@ /* ISC license. */ #include <errno.h> +#include <skalibs/allreadwrite.h> #include <skalibs/error.h> #include <skalibs/tai.h> #include <skalibs/unixmessage.h> @@ -12,7 +13,7 @@ int s6_fdholder_list (s6_fdholder_t *a, stralloc *sa, tain_t const *deadline, ta unixmessage_t m ; if (!s6_fdholder_list_async(a)) return -1 ; if (!unixmessage_sender_timed_flush(&a->connection.out, deadline, stamp)) return -1 ; - if (!unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) return -1 ; + if (sanitize_read(unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) < 0) return -1 ; if (!s6_fdholder_list_cb(&m, &res)) return -1 ; if (res.err) return (errno = res.err, -1) ; return (int)res.n ; diff --git a/src/libs6/s6_fdholder_list_cb.c b/src/libs6/s6_fdholder_list_cb.c @@ -2,6 +2,7 @@ #include <errno.h> #include <skalibs/uint32.h> +#include <skalibs/bytestr.h> #include <skalibs/error.h> #include <skalibs/stralloc.h> #include <skalibs/unixmessage.h> @@ -19,6 +20,7 @@ int s6_fdholder_list_cb (unixmessage_t const *m, void *p) return 1 ; } uint32_unpack_big(m->s + 1, &n) ; + if (byte_count(m->s + 5, m->len - 5, 0) != n) goto err ; if (!stralloc_catb(res->sa, m->s + 5, m->len - 5)) return 0 ; res->n = n ; res->err = 0 ; diff --git a/src/libs6/s6_fdholder_retrieve.c b/src/libs6/s6_fdholder_retrieve.c @@ -1,6 +1,7 @@ /* ISC license. */ #include <errno.h> +#include <skalibs/allreadwrite.h> #include <skalibs/tai.h> #include <skalibs/unixmessage.h> #include <s6/s6-fdholder.h> @@ -11,7 +12,7 @@ int s6_fdholder_retrieve_maybe_delete (s6_fdholder_t *a, char const *id, int dod s6_fdholder_retrieve_result_t res ; if (!s6_fdholder_retrieve_maybe_delete_async(a, id, dodelete)) return -1 ; if (!unixmessage_sender_timed_flush(&a->connection.out, deadline, stamp)) return -1 ; - if (!unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) return -1 ; + if (sanitize_read(unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) < 0) return -1 ; if (!s6_fdholder_retrieve_cb(&m, &res)) return -1 ; if (res.err) return (errno = res.err, -1) ; return res.fd ; diff --git a/src/libs6/s6_fdholder_setdump.c b/src/libs6/s6_fdholder_setdump.c @@ -2,6 +2,7 @@ #include <errno.h> #include <skalibs/uint32.h> +#include <skalibs/allreadwrite.h> #include <skalibs/bytestr.h> #include <skalibs/error.h> #include <skalibs/tai.h> @@ -25,7 +26,7 @@ int s6_fdholder_setdump (s6_fdholder_t *a, s6_fdholder_fd_t const *list, unsigne uint32_pack_big(pack+1, ntot) ; if (!unixmessage_put(&a->connection.out, &m)) return 0 ; if (!unixmessage_sender_timed_flush(&a->connection.out, deadline, stamp)) return 0 ; - if (!unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) return 0 ; + if (sanitize_read(unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) < 0) return 0 ; if (!m.len || m.nfds) { unixmessage_drop(&m) ; return (errno = EPROTO, 0) ; } if (m.s[0]) return (errno = m.s[0], 0) ; if (m.len != 5) return (errno = EPROTO, 0) ; @@ -58,7 +59,7 @@ int s6_fdholder_setdump (s6_fdholder_t *a, s6_fdholder_fd_t const *list, unsigne if (!unixmessage_sender_timed_flush(&a->connection.out, deadline, stamp)) return 0 ; { unixmessage_t m ; - if (!unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) return 0 ; + if (sanitize_read(unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) < 0) return 0 ; if (m.len != 1 || m.nfds) { unixmessage_drop(&m) ; diff --git a/src/libs6/s6_fdholder_store.c b/src/libs6/s6_fdholder_store.c @@ -1,6 +1,7 @@ /* ISC license. */ #include <errno.h> +#include <skalibs/allreadwrite.h> #include <skalibs/error.h> #include <skalibs/tai.h> #include <skalibs/unixmessage.h> @@ -11,7 +12,7 @@ int s6_fdholder_store (s6_fdholder_t *a, int fd, char const *id, tain_t const *l unixmessage_t m ; if (!s6_fdholder_store_async(a, fd, id, limit)) return 0 ; if (!unixmessage_sender_timed_flush(&a->connection.out, deadline, stamp)) return 0 ; - if (!unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) return 0 ; + if (sanitize_read(unixmessage_timed_receive(&a->connection.in, &m, deadline, stamp)) < 0) return 0 ; if (m.len != 1 || m.nfds) { unixmessage_drop(&m) ;