commoncap.c (002345925e6c45861f60db6f4fc6236713fd8847) commoncap.c (d78ca3cd733d8a2c3dcd88471beb1a15d973eed8)
1/* Common capabilities, needed by capability.o.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 */

--- 883 unchanged lines hidden (view full) ---

892 * @from_file: Whether this request came from an open file (i.e. /proc)
893 *
894 * Determine whether the current process is permitted to use a particular
895 * syslog function, returning 0 if permission is granted, -ve if not.
896 */
897int cap_syslog(int type, bool from_file)
898{
899 /* /proc/kmsg can open be opened by CAP_SYS_ADMIN */
1/* Common capabilities, needed by capability.o.
2 *
3 * This program is free software; you can redistribute it and/or modify
4 * it under the terms of the GNU General Public License as published by
5 * the Free Software Foundation; either version 2 of the License, or
6 * (at your option) any later version.
7 *
8 */

--- 883 unchanged lines hidden (view full) ---

892 * @from_file: Whether this request came from an open file (i.e. /proc)
893 *
894 * Determine whether the current process is permitted to use a particular
895 * syslog function, returning 0 if permission is granted, -ve if not.
896 */
897int cap_syslog(int type, bool from_file)
898{
899 /* /proc/kmsg can open be opened by CAP_SYS_ADMIN */
900 if (type != 1 && from_file)
900 if (type != SYSLOG_ACTION_OPEN && from_file)
901 return 0;
901 return 0;
902 if ((type != 3 && type != 10) && !capable(CAP_SYS_ADMIN))
902 if ((type != SYSLOG_ACTION_READ_ALL &&
903 type != SYSLOG_ACTION_SIZE_BUFFER) && !capable(CAP_SYS_ADMIN))
903 return -EPERM;
904 return 0;
905}
906
907/**
908 * cap_vm_enough_memory - Determine whether a new virtual mapping is permitted
909 * @mm: The VM space in which the new mapping is to be made
910 * @pages: The size of the mapping

--- 43 unchanged lines hidden ---
904 return -EPERM;
905 return 0;
906}
907
908/**
909 * cap_vm_enough_memory - Determine whether a new virtual mapping is permitted
910 * @mm: The VM space in which the new mapping is to be made
911 * @pages: The size of the mapping

--- 43 unchanged lines hidden ---