version 1.24, 2002/02/20 23:12:05
|
version 1.25, 2002/02/23 00:27:20
|
|
|
#include <time.h> | #include <time.h> |
#include <netdb.h> | #include <netdb.h> |
#include <Pegasus/Common/Tracer.h> | #include <Pegasus/Common/Tracer.h> |
|
#include <Pegasus/Common/Destroyer.h> |
| |
#ifdef PEGASUS_PLATFORM_LINUX_IX86_GNU | #ifdef PEGASUS_PLATFORM_LINUX_IX86_GNU |
#include <pwd.h> | #include <pwd.h> |
|
|
return true; | return true; |
} | } |
| |
Boolean System::isPrivilegedUser() |
Boolean System::isPrivilegedUser(const String userName) |
|
{ |
|
// |
|
// Check if username has been passed |
|
// |
|
if ( userName != String::EMPTY ) |
|
{ |
|
// |
|
// Check if the given user is a privileged user |
|
// |
|
struct passwd pwd; |
|
struct passwd *result; |
|
char pwdBuffer[1024]; |
|
|
|
ArrayDestroyer<char> userName_(userName.allocateCString()); |
|
if (getpwnam_r(userName_.getPointer(), &pwd, pwdBuffer, 1024, &result) == 0) |
|
{ |
|
if ( pwd.pw_uid == 0 ) |
|
{ |
|
return true; |
|
} |
|
return false; |
|
} |
|
} |
|
else |
{ | { |
// | // |
// Get the effective UID for the user | // Get the effective UID for the user |
|
|
} | } |
return true; | return true; |
} | } |
|
} |
| |
Uint32 System::getPID() | Uint32 System::getPID() |
{ | { |