X-Git-Url: https://git.karo-electronics.de/?a=blobdiff_plain;f=security%2Fcommoncap.c;h=61669730da98e05c77d18c77e853fc922f3031a5;hb=6d327cb03fbc64cac36571c9bc8a1576d2b3ea00;hp=f800fdb3de94136a093f51b11d0ca5e9eaf686e8;hpb=3095b165a14b1a95eb500bcaf13ad725a27fe825;p=karo-tx-linux.git diff --git a/security/commoncap.c b/security/commoncap.c index f800fdb3de94..61669730da98 100644 --- a/security/commoncap.c +++ b/security/commoncap.c @@ -27,6 +27,7 @@ #include #include #include +#include /* * If a non-root user executes a setuid-root binary in @@ -888,13 +889,17 @@ error: /** * cap_syslog - Determine whether syslog function is permitted * @type: Function requested + * @from_file: Whether this request came from an open file (i.e. /proc) * * Determine whether the current process is permitted to use a particular * syslog function, returning 0 if permission is granted, -ve if not. */ -int cap_syslog(int type) +int cap_syslog(int type, bool from_file) { - if ((type != 3 && type != 10) && !capable(CAP_SYS_ADMIN)) + if (type != SYSLOG_ACTION_OPEN && from_file) + return 0; + if ((type != SYSLOG_ACTION_READ_ALL && + type != SYSLOG_ACTION_SIZE_BUFFER) && !capable(CAP_SYS_ADMIN)) return -EPERM; return 0; }