using namespace ctx;
static GMutex __pathMutex;
-static uid_t __normalUid = ROOT_UID; // Last known normal user UID
-static uid_t __containerUid = ROOT_UID; // Last known container user UID
static GDBusConnection* __dbusConnection = NULL;
EXPORT_API bool util::is_normal_user(uid_t uid)
if (uid == ROOT_UID)
return false;
- if (uid == __normalUid)
- return true;
-
- if (uid == __containerUid)
- return false;
-
- int type = sd_get_uid_type(uid);
-
- if (type == NORMAL_USER_TYPE) {
- __normalUid = uid;
- return true;
- } else if (type == CONTAINER_TYPE) {
- __containerUid = uid;
- return false;
- }
-
- return false;
+ return true;
}
EXPORT_API bool util::is_container_user(uid_t uid)
{
- if (uid == ROOT_UID)
- return false;
-
- if (uid == __containerUid)
- return true;
-
- if (uid == __normalUid)
- return false;
-
- int type = sd_get_uid_type(uid);
-
- if (type == CONTAINER_TYPE) {
- __containerUid = uid;
- return true;
- } else if (type == NORMAL_USER_TYPE) {
- __normalUid = uid;
- return false;
- }
-
return false;
}