summaryrefslogtreecommitdiff
path: root/src/libs6
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2015-01-23 16:07:31 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2015-01-23 16:07:31 +0000
commite62d3ae45e9bf3b97551b8879bf6c441ff961ec1 (patch)
tree239987a77426dac08b2877b8e0afab5d4aae6eff /src/libs6
parent2c922d2f9870ef174894a6b91399d5cd59318352 (diff)
downloads6-e62d3ae45e9bf3b97551b8879bf6c441ff961ec1.tar.xz
- add s6_accessrules_params_free
- some libfdholder debug
Diffstat (limited to 'src/libs6')
-rw-r--r--src/libs6/deps-lib/s61
-rw-r--r--src/libs6/s6_accessrules_params_free.c10
-rw-r--r--src/libs6/s6_fdholder_delete.c3
-rw-r--r--src/libs6/s6_fdholder_getdump.c5
-rw-r--r--src/libs6/s6_fdholder_list.c3
-rw-r--r--src/libs6/s6_fdholder_list_cb.c2
-rw-r--r--src/libs6/s6_fdholder_retrieve.c3
-rw-r--r--src/libs6/s6_fdholder_setdump.c5
-rw-r--r--src/libs6/s6_fdholder_store.c3
9 files changed, 27 insertions, 8 deletions
diff --git a/src/libs6/deps-lib/s6 b/src/libs6/deps-lib/s6
index 35a3296..01b67c3 100644
--- 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
new file mode 100644
index 0000000..5eabfde
--- /dev/null
+++ 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
index 0432421..fd7aa4e 100644
--- 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
index 3fce3a7..f464546 100644
--- 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
index 4f804aa..868a3e6 100644
--- 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
index bfdee50..d465004 100644
--- 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
index e2888a9..caf2426 100644
--- 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
index e5825dc..61c238c 100644
--- 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
index 4241d8d..7b8f6dc 100644
--- 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) ;