version 1.61, 2003/08/04 13:30:39
|
version 1.62, 2003/08/06 14:46:10
|
|
|
void System::unloadDynamicLibrary(DynamicLibraryHandle libraryHandle) | void System::unloadDynamicLibrary(DynamicLibraryHandle libraryHandle) |
{ | { |
// ATTN: Should this method indicate success/failure? | // ATTN: Should this method indicate success/failure? |
#ifdef PEGASUS_OS_LINUX |
#if defined(PEGASUS_OS_LINUX) || defined(PEGASUS_OS_SOLARIS) |
dlclose(libraryHandle); | dlclose(libraryHandle); |
#endif | #endif |
| |
|
|
// Get wbem-local port from /etc/services | // Get wbem-local port from /etc/services |
// | // |
#if !defined(PEGASUS_OS_OS400) | #if !defined(PEGASUS_OS_OS400) |
|
#ifdef PEGASUS_OS_SOLARIS |
|
#define SERV_BUFF_SIZE 1024 |
|
struct servent serv_result; |
|
char buf[SERV_BUFF_SIZE]; |
|
|
|
if ( (serv = getservbyname_r(serviceName, TCP, &serv_result, |
|
buf, SERV_BUFF_SIZE)) != NULL ) |
|
#else // PEGASUS_OS_SOLARIS |
if ( (serv = getservbyname(serviceName, TCP)) != NULL ) | if ( (serv = getservbyname(serviceName, TCP)) != NULL ) |
#else |
#endif // PEGASUS_OS_SOLARIS |
|
#else // !PEGASUS_OS_OS400 |
// Need to cast on OS/400 | // Need to cast on OS/400 |
if ( (serv = getservbyname((char *)serviceName, TCP)) != NULL ) | if ( (serv = getservbyname((char *)serviceName, TCP)) != NULL ) |
#endif |
#endif // !PEGASUS_OS_OS400 |
{ | { |
localPort = htons((uint16_t)serv->s_port); | localPort = htons((uint16_t)serv->s_port); |
} | } |
|
|
String userName = String::EMPTY; | String userName = String::EMPTY; |
struct passwd* pwd = NULL; | struct passwd* pwd = NULL; |
| |
|
#ifdef PEGASUS_OS_SOLARIS |
|
#define PWD_BUFF_SIZE 1024 |
|
struct passwd local_pwd; |
|
char buf[PWD_BUFF_SIZE]; |
|
if(getpwuid_r(geteuid(), &local_pwd, buf, PWD_BUFF_SIZE, &pwd)) { |
|
pwd = (struct passwd *)NULL; |
|
} |
|
#else |
// | // |
// get the currently logged in user's UID. | // get the currently logged in user's UID. |
// | // |
pwd = getpwuid(geteuid()); | pwd = getpwuid(geteuid()); |
|
#endif |
if ( pwd == NULL ) | if ( pwd == NULL ) |
{ | { |
//ATTN: Log a message | //ATTN: Log a message |
|
|
| |
Boolean System::isSystemUser(const char* userName) | Boolean System::isSystemUser(const char* userName) |
{ | { |
|
#ifdef PEGASUS_OS_SOLARIS |
|
struct passwd pwd; |
|
struct passwd *result; |
|
char pwdBuffer[1024]; |
|
|
|
if (getpwnam_r(userName, &pwd, pwdBuffer, 1024, &result) != 0) |
|
#else |
// | // |
// get the password entry for the user | // get the password entry for the user |
// | // |
if ( getpwnam(userName) == NULL ) | if ( getpwnam(userName) == NULL ) |
|
#endif |
{ | { |
return false; | return false; |
} | } |
|
|
if (userName == String::EMPTY) | if (userName == String::EMPTY) |
{ | { |
struct passwd* pwd = NULL; | struct passwd* pwd = NULL; |
|
#ifdef PEGASUS_OS_SOLARIS |
|
struct passwd local_pwd; |
|
char buf[PWD_BUFF_SIZE]; |
|
if(getpwuid_r(0, &local_pwd, buf, PWD_BUFF_SIZE, &pwd)) { |
|
pwd = (struct passwd *)NULL; |
|
} |
|
#else |
// | // |
// get the privileged user's UID. | // get the privileged user's UID. |
// | // |
// (on OS/400, this is QSECOFR) | // (on OS/400, this is QSECOFR) |
pwd = getpwuid(0); | pwd = getpwuid(0); |
|
#endif |
if ( pwd != NULL ) | if ( pwd != NULL ) |
{ | { |
// | // |