Skip to content
Snippets Groups Projects
Commit 69b8a583 authored by scjody's avatar scjody
Browse files

Branch b1_6

Permission check update to libsysio.

b=12884
parent 9c167524
No related branches found
No related tags found
No related merge requests found
...@@ -46,6 +46,11 @@ ...@@ -46,6 +46,11 @@
#ifndef _CREDS_H_ #ifndef _CREDS_H_
#define _CREDS_H_ #define _CREDS_H_
/*
* Superuser's UID.
*/
#define _SYSIO_ROOT_UID 0
/* /*
* Data structure for user credentials * Data structure for user credentials
*/ */
...@@ -56,4 +61,12 @@ struct creds { ...@@ -56,4 +61,12 @@ struct creds {
int creds_ngids; int creds_ngids;
}; };
#ifdef _SYSIO_ROOT_UID
/*
* Is caller the superuser?
*/
#define _sysio_is_root(_crp) \
((_crp)->creds_uid == _SYSIO_ROOT_UID)
#endif
#endif #endif
...@@ -99,6 +99,16 @@ _sysio_check_permission(struct pnode *pno, struct creds *crp, int amode) ...@@ -99,6 +99,16 @@ _sysio_check_permission(struct pnode *pno, struct creds *crp, int amode)
err = -EACCES; /* assume error */ err = -EACCES; /* assume error */
stat = &ino->i_stbuf; stat = &ino->i_stbuf;
do { do {
#ifdef _SYSIO_ROOT_UID
/*
* Root?
*/
if (_sysio_is_root(crp)) {
err = 0;
break;
}
#endif
/* /*
* Owner? * Owner?
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment