X-Git-Url: https://git.distorted.org.uk/~mdw/yaid/blobdiff_plain/b9eb1a366ff0127c49a0589905435680b137d49f..HEAD:/yaid.h diff --git a/yaid.h b/yaid.h index a91ea27..eb874cb 100644 --- a/yaid.h +++ b/yaid.h @@ -67,6 +67,7 @@ #include #include #include +#include #include #include #include @@ -248,8 +249,11 @@ struct query { /* Format and log MSG somewhere sensible, at the syslog(3) priority PRIO. * Prefix it with a description of the query Q, if non-null. */ -extern void logmsg(const struct query */*q*/, - int /*prio*/, const char */*msg*/, ...); +extern void PRINTF_LIKE(3, 4) + logmsg(const struct query */*q*/, int /*prio*/, const char */*msg*/, ...); + +/* Format and report MSG as a fatal error, and exit. */ +extern void PRINTF_LIKE(1, 2) fatal(const char */*msg*/, ...); /*----- System-specific connection identification code --------------------*/ @@ -259,6 +263,12 @@ extern void logmsg(const struct query */*q*/, */ extern void identify(struct query */*q*/); +/* Fill the buffer at P with SZ random bytes. The buffer will be moderately + * large: this is intended to be a low-level interface, not a general-purpose + * utility. + */ +extern void fill_random(void */*p*/, size_t /*sz*/); + /* Initialize the system-specific code. */ extern void init_sys(void); @@ -347,6 +357,11 @@ struct policy_file { /* Open a policy file by NAME. The description WHAT and query Q are used for * formatting error messages for the log. + * + * This function is somewhat careful only to read from actual regular files, + * though (if the filesystem object identified by NAME is a symlink, say) it + * might open a device node or other exotic thing without reading it. This + * is likely harmless, since we're running as an unprivileged user anyway. */ extern int open_policy_file(struct policy_file */*pf*/, const char */*name*/, const char */*what*/, const struct query */*q*/,