Information Returned by <i>stat()</i>



next up previous contents
Next: Attribute Manipulation Up: Different File Attributes Previous: Execute/Search Permissions

Information Returned by stat()

The function stat() returns read/write and execute/search permissions for the file owner class, file group class, and file other class. Moreover, it returns the file's user ID and group ID plus several other things. As is noted in sections 4.2.1 and 4.2.2, a file system may not support user ID, group ID, and/or execute/search permissions. Consequently, stat() is unable to return meaningful information in those fields of the stat() structure.

In addition, it is possible that a file system may support the concept of user and group ownership of a file but the client's user/group identification information may differ from a server's user/group identification information. In such a case, in order to accomplish file access control between client and server, there must be a mapping of the client's user/group identification information to a server's user/group identification information.

For example, suppose Client A, Client B, and Server S all support IEEE 1003.1-1990. Client A, Client B, and Server S are each separately administered. The individual KO has an account on both clients and the server. On Client A, KO has a user ID of 10; on Client B, KO has a user ID of 15; on Server S, KO has a user ID of 20. The user KO is known by a different user ID on each of Client A, Client B, and Server S. Suppose Client A and Client B are using files on Server S. Server S, who knows KO as user ID 20, must be able to identify KO as user ID 10 when file access is attempted from Client A and as user ID 15 when access is attempted from Client B. Suppose Server S uses a simple mapping table which associates: (user ID 10, user ID 20) and (user ID 15, user ID 20). Now, Server S gets an access request for user ID 10, applies the mapping to get user ID 20, and then applies the file access control procedure based on a user ID of 20. Using the mapping, file access control works as it should for KO's files.

However, suppose an application on Client A performs a stat() on a file which has user ID 20 and is located on Server S. The server is unable to return meaningful information in the user ID part of the stat() structure. Server S cannot identify the file as owned by user ID 10 because the mapping is not one-to-one. The inverse mapping of user ID 20 gives both user ID 10 and user ID 15. Returning user ID 20, which the server knows as the owner of the file, wrongly identifies the file to the application on Client A. User ID 20 is not KO on Client A.

It is important to distinguish the functioning of the file access control mechanism of a file system and the ability of a file system to return meaningful information to a stat(). Note that, in the example, the file access control mechanism functioned as specified in IEEE 1003.1-1990 but the server was unable to return meaningful information about the file's owner. Most applications are capable of performing their primary function as long as they are able to access files. It is usually not necessary for an application to ascertain how the file access control mechanism functions. However, an application should be able to determine the meaningfulness of the information returned by stat().



next up previous contents
Next: Attribute Manipulation Up: Different File Attributes Previous: Execute/Search Permissions



Karen Olsen
Mon Aug 21 10:18:32 EDT 1995