X-Git-Url: https://www.chiark.greenend.org.uk/ucgi/~mdw/git/yaid/blobdiff_plain/1e00cfaa52ebc00219d8154721604bbc9ce3f1ad..af7ed5c7d9bc023182dc0dd4d27605d19168c43c:/yaid.h diff --git a/yaid.h b/yaid.h index ef3e726..15f26bf 100644 --- a/yaid.h +++ b/yaid.h @@ -67,6 +67,7 @@ #include #include #include +#include #include #include #include @@ -248,8 +249,8 @@ 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*/, ...); /*----- System-specific connection identification code --------------------*/ @@ -330,8 +331,8 @@ extern int match_policy(const struct policy */*p*/, enum { T_OK, /* Successful: results returned */ T_EOL, /* End-of-line found immediately */ - T_EOF, /* End-of-file found immediately */ - T_ERROR /* Some kind of error occurred */ + T_ERROR, /* Some kind of error occurred */ + T_EOF /* End-of-file found immediately */ }; /* A context for parsing a policy file. */ @@ -347,6 +348,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*/,