Users

Since filesystems such as ext2 employ the concepts of users and groups, and since access to such filesystems might be expected to respect the recorded user and group metadata, permitting or denying access to objects as appropriate, the need arises to define a user identity to control access to a filesystem server and the filesystem objects it exposes.

Opener Configuration

Consequently, a filesystem server may not provide direct access to a filesystem. Instead, it may only expose the Filesystem interface which provides the open_for_user operation. This operation is used to configure an Opener that provides the actual interface for filesystem access as performed by a particular user.

Since the open_for_user operation involves the indication of an arbitrary user identity, a server providing the Filesystem interface should only be exposed to appropriately privileged components. An Opener obtained from the operation can then be presented to a less privileged component.

User Structure

Ordinarily, user information is exchanged using a user_t structure defined in libsystypes with the following members:

Member Description
uid User identifier
gid Group identifier
umask File mode creation mask

The information broadly follows that of a traditional Unix system. Other information, such as supplementary groups might conceivably be provided to the filesystem server separately. Indeed, the user structure might be simplified, removing the primary group information and providing this separately, too.

Opener Configuration in Ned

The following example illustrates the configuration of an opener and the provision of the opener to a new task in the Lua-based scripting environment of the Ned component in L4Re:

-- Obtain user filesystems with umask 0022 (18).

local open_for_user = 6;
local ext2svr_paulb = L4.cast(L4.Proto.Factory, ext2svr):create(open_for_user, 1000, 1000, 18);

l:startv({
    caps = {
      server = ext2svr_paulb,
    },
    log = { "client", "g" },
  },
  -- program, file to create
  "rom/dstest_file_client", "home/paulb/new file");

Here, ext2svr_paulb is an opener configured for the user paulb who has user and group identifiers of 1000. Since the Lua environment emphasises the L4Re factory mechanism, and since factory operations involve the use of L4Re variable-sized arguments ("vargs") as parameters, the signature of the factory version of the operation consists of the individual elements of the user abstraction:

open_for_user(in ipc_varg_sys_uid_t uid,
              in ipc_varg_sys_gid_t gid,
              in ipc_varg_sys_mode_t umask,
              out cap opener)