From: David Y. <dav...@in...> - 2011-02-25 10:57:04
|
This patch provides an abstraction for POSIX users management. I want to remark that it doesn't use the actual underlying UIDs of users (because they may not exist, if running in Windows for instance). Instead, UIDs are arbitrary values generated inside the library. If you plan to read an UID (a real one) from file and call getpwuid (for instance), this code is not for you. New libstd headers: libstd/include/pwd.h New libstd functions (implemented in libstd/src/_users.c): getuid() geteuid() getpwuid() getpwnam() New core functions matching the previous one in a marshal-safe way. The __host.c ones are just wrappers. The MSCorelibWrapper.cs ones behave as follows: getuid() - Returns (or allocate at first time) a UID for current user geteuid() - Just calls the previous one. Effective user is assumed current user (may be it is related to Impersonation in .NET, I have to research about this). getpwuid() - Gets the .NET user name from the UID and behave and behaves as getpwnam() getpwnam() - Gets (or allocate at first time) a UID for the given user. Given the user name, returns null as password, user login as real name (we could research on this), home path as home path, null as shell. In addition, some private functions are implemented to manage UID and user name mappings. The useful ones: GetNameFromUid and GetUidFromName. The behavior can be tested with test_users.c (build and run both in mono and in native through gcil) Affected benchmarks: 186.crafty |