diff options
Diffstat (limited to 'src/authz.h')
| -rw-r--r-- | src/authz.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/src/authz.h b/src/authz.h index 8e6c2bb..d107fd8 100644 --- a/src/authz.h +++ b/src/authz.h @@ -160,6 +160,24 @@ typedef struct { size_t cap; } strbuf_t; +// A file, one entry per line. The newline is kept, and a last line without one +// is given one, so the lines may be written straight back out again. +typedef struct { + char **v; + size_t n; + size_t cap; +} lines_t; + +void lines_init(lines_t *l); +void lines_push(lines_t *l, char *s); // takes ownership +void lines_free(lines_t *l); + +// 0, -1 when the file cannot be opened, or -2 when reading stopped before the +// end - a directory, an I/O error halfway, a mount pulled out. errno says which. +// The caller decides what a missing file means: an emergency for the policy, a +// plain fact for a validator cross-checking a host. +int authz_read_lines(const char *path, lines_t *l); + void sb_init(strbuf_t *b); void sb_add(strbuf_t *b, const char *s); void sb_addf(strbuf_t *b, const char *fmt, ...); |
