From: scjody Date: Fri, 3 Aug 2007 17:07:16 +0000 (+0000) Subject: Branch b1_6 X-Git-Tag: v1_7_91~90 X-Git-Url: https://git.whamcloud.com/?p=fs%2Flustre-release.git;a=commitdiff_plain;h=69b8a5830acdb9077455080cca10a9e9c4622c5d Branch b1_6 Permission check update to libsysio. b=12884 --- diff --git a/libsysio/include/creds.h b/libsysio/include/creds.h index 90305e1..672dfcf 100644 --- a/libsysio/include/creds.h +++ b/libsysio/include/creds.h @@ -47,6 +47,11 @@ #define _CREDS_H_ /* + * Superuser's UID. + */ +#define _SYSIO_ROOT_UID 0 + +/* * Data structure for user credentials */ @@ -56,4 +61,12 @@ struct creds { int creds_ngids; }; + +#ifdef _SYSIO_ROOT_UID +/* + * Is caller the superuser? + */ +#define _sysio_is_root(_crp) \ + ((_crp)->creds_uid == _SYSIO_ROOT_UID) +#endif #endif diff --git a/libsysio/src/access.c b/libsysio/src/access.c index 80e8fcd..784de8e 100644 --- a/libsysio/src/access.c +++ b/libsysio/src/access.c @@ -99,6 +99,16 @@ _sysio_check_permission(struct pnode *pno, struct creds *crp, int amode) err = -EACCES; /* assume error */ stat = &ino->i_stbuf; do { +#ifdef _SYSIO_ROOT_UID + /* + * Root? + */ + if (_sysio_is_root(crp)) { + err = 0; + break; + } +#endif + /* * Owner? */