Whamcloud - gitweb
Branch b1_6
authorscjody <scjody>
Fri, 3 Aug 2007 17:07:16 +0000 (17:07 +0000)
committerscjody <scjody>
Fri, 3 Aug 2007 17:07:16 +0000 (17:07 +0000)
Permission check update to libsysio.

b=12884

libsysio/include/creds.h
libsysio/src/access.c

index 90305e1..672dfcf 100644 (file)
 #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 {
        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
index 80e8fcd..784de8e 100644 (file)
@@ -99,6 +99,16 @@ _sysio_check_permission(struct pnode *pno, struct creds *crp, int amode)
        err = -EACCES;                                  /* assume error */
        stat = &ino->i_stbuf;
        do {
        err = -EACCES;                                  /* assume error */
        stat = &ino->i_stbuf;
        do {
+#ifdef _SYSIO_ROOT_UID
+               /*
+                * Root?
+                */
+               if (_sysio_is_root(crp)) {
+                       err = 0;
+                       break;
+               }
+#endif
+
                /*
                 * Owner?
                 */
                /*
                 * Owner?
                 */