Should UID 0 or GID 0 have a special meaning in RTEMS?
Sebastian Huber
sebastian.huber at embedded-brains.de
Fri Feb 17 16:15:18 UTC 2012
Hello,
I work currently with the RTEMS file system subsystem. I want to unify the
access checks. The question is if UID 0 or GID 0 should have a special meaning
in RTEMS?
Do we want this
bool rtems_filesystem_check_access(
int eval_flags,
mode_t node_mode,
uid_t node_uid,
gid_t node_gid
)
{
mode_t perm_flags = eval_flags & RTEMS_LIBIO_PERMS_RWX;
uid_t task_uid = geteuid();
if (task_uid == 0 || task_uid == node_uid) {
perm_flags <<= 6;
} else {
gid_t task_gid = getegid();
if (task_gid == 0 || task_gid == node_gid) {
perm_flags <<= 3;
} else {
perm_flags <<= 0;
}
}
return (perm_flags & node_mode) == perm_flags;
}
or this
bool rtems_filesystem_check_access(
int eval_flags,
mode_t node_mode,
uid_t node_uid,
gid_t node_gid
)
{
mode_t perm_flags = eval_flags & RTEMS_LIBIO_PERMS_RWX;
if (geteuid() == node_uid) {
perm_flags <<= 6;
} else if (getegid() == node_gid) {
perm_flags <<= 3;
} else {
perm_flags <<= 0;
}
return (perm_flags & node_mode) == perm_flags;
}
?
--
Sebastian Huber, embedded brains GmbH
Address : Obere Lagerstr. 30, D-82178 Puchheim, Germany
Phone : +49 89 18 90 80 79-6
Fax : +49 89 18 90 80 79-9
E-Mail : sebastian.huber at embedded-brains.de
PGP : Public key available on request.
Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.
More information about the devel
mailing list