version 1.49, 2002/09/05 17:58:10
|
version 1.55, 2003/03/14 14:54:14
|
|
|
// Sushma Fernandes (sushma_fernandes@hp.com) | // Sushma Fernandes (sushma_fernandes@hp.com) |
// Nag Boranna (nagaraja_boranna@hp.com) | // Nag Boranna (nagaraja_boranna@hp.com) |
// | // |
|
// Modified By: Dave Rosckes (rosckes@us.ibm.com) |
|
// |
//%///////////////////////////////////////////////////////////////////////////// | //%///////////////////////////////////////////////////////////////////////////// |
| |
#ifdef PEGASUS_OS_HPUX | #ifdef PEGASUS_OS_HPUX |
|
|
# include <pointer.h> /* _SYSPTR */ | # include <pointer.h> /* _SYSPTR */ |
# include <qusec.h> /* Qus_EC_t */ | # include <qusec.h> /* Qus_EC_t */ |
# include <qleawi.h> /* QleActBndPgm(),QleGetExp() */ | # include <qleawi.h> /* QleActBndPgm(),QleGetExp() */ |
|
# include <qycmutiltyUtility.H> |
# include <unistd.cleinc> | # include <unistd.cleinc> |
|
# include "qycmmsgclsMessage.H" // ycmMessage class |
#else | #else |
# include <dlfcn.h> | # include <dlfcn.h> |
#endif | #endif |
|
|
#include <crypt.h> | #include <crypt.h> |
#endif | #endif |
| |
|
#if defined(PEGASUS_USE_SYSLOGS) |
|
#include <syslog.h> |
|
#endif |
|
|
#include <sys/stat.h> | #include <sys/stat.h> |
#include <sys/types.h> | #include <sys/types.h> |
#include <cstdio> | #include <cstdio> |
|
|
if (!*hostname) | if (!*hostname) |
gethostname(hostname, sizeof(hostname)); | gethostname(hostname, sizeof(hostname)); |
| |
// (temporary?) fix for problem of object path creation with |
|
// fully-qualified hostname |
|
char *dot = strchr(hostname, '.'); |
|
if (dot != NULL) *dot = '\0'; |
|
|
|
return hostname; | return hostname; |
} | } |
| |
|
|
// | // |
// Check if the given user is a privileged user | // Check if the given user is a privileged user |
// | // |
|
#if !defined(PEGASUS_OS_OS400) |
struct passwd pwd; | struct passwd pwd; |
struct passwd *result; | struct passwd *result; |
char pwdBuffer[1024]; | char pwdBuffer[1024]; |
|
|
} | } |
} | } |
return false; | return false; |
|
#else |
|
return ycmCheckUserCmdAuthorities(userName.getCString()); |
|
#endif |
} | } |
| |
String System::getPrivilegedUserName() | String System::getPrivilegedUserName() |
|
|
// | // |
// get the privileged user's UID. | // get the privileged user's UID. |
// | // |
|
// (on OS/400, this is QSECOFR) |
pwd = getpwuid(0); | pwd = getpwuid(0); |
if ( pwd != NULL ) | if ( pwd != NULL ) |
{ | { |
|
|
#endif | #endif |
} | } |
| |
|
// Is absolute path? |
|
Boolean System::is_absolute_path(const char *path) |
|
{ |
|
if (path == NULL) |
|
return false; |
|
|
|
if (path[0] == '/') |
|
return true; |
|
|
|
return false; |
|
} |
|
|
|
void System::openlog(const String ident) |
|
{ |
|
#if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_IA64_GNU) |
|
|
|
::openlog(ident.getCString(), LOG_PID|LOG_CONS, LOG_DAEMON); |
|
|
|
#endif |
|
|
|
return; |
|
} |
|
|
|
void System::syslog(Uint32 severity, const char *data) |
|
{ |
|
#if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_IA64_GNU) |
|
|
|
// FUTURE-SF-P3-20020517 : Use the Syslog on HP-UX. Eventually only |
|
// certain messages will go to the Syslog and others to the |
|
// Pegasus Logger. |
|
Uint32 syslogLevel = LOG_DEBUG; |
|
|
|
// Map the log levels. |
|
if (severity & Logger::TRACE) syslogLevel = LOG_DEBUG; |
|
if (severity & Logger::INFORMATION) syslogLevel = LOG_INFO; |
|
if (severity & Logger::WARNING) syslogLevel = LOG_WARNING; |
|
if (severity & Logger::SEVERE) syslogLevel = LOG_ERR; |
|
if (severity & Logger::FATAL) syslogLevel = LOG_CRIT; |
|
|
|
::syslog(syslogLevel, "%s", data); |
|
|
|
#elif defined(PEGASUS_OS_OS400) |
|
|
|
std::string replacementData = data; |
|
// All messages will go to the joblog. In the future |
|
// some messages may go to other message queues yet |
|
// to be determined. |
|
if ((severity & Logger::TRACE) || |
|
(severity & Logger::INFORMATION)) |
|
{ |
|
|
|
// turn into ycmMessage so we can put it in the job log |
|
ycmMessage theMessage(msgCPxDF80, |
|
CPIprefix, |
|
replacementData, |
|
"Logger",ycmCTLCIMID); |
|
|
|
// put the message in the joblog |
|
theMessage.joblogIt(UnitOfWorkError, |
|
ycmMessage::Informational); |
|
} |
|
|
|
if ((severity & Logger::WARNING) || |
|
(severity & Logger::SEVERE) || |
|
(severity & Logger::FATAL)) |
|
{ |
|
// turn into ycmMessage so we can put it in the job log |
|
ycmMessage theMessage(msgCPxDF82, |
|
CPDprefix, |
|
replacementData, |
|
"Logger",ycmCTLCIMID); |
|
|
|
// put the message in the joblog |
|
theMessage.joblogIt(UnitOfWorkError, |
|
ycmMessage::Diagnostic); |
|
} |
|
|
|
#endif |
|
|
|
return; |
|
} |
|
|
|
void System::closelog() |
|
{ |
|
#if defined(PEGASUS_OS_HPUX) || defined(PEGASUS_PLATFORM_LINUX_IA64_GNU) |
|
|
|
::closelog(); |
|
|
|
#endif |
|
|
|
return; |
|
} |
|
|
|
// System ID constants for Logger::put and Logger::trace |
|
#if defined(PEGASUS_PLATFORM_OS400_ISERIES_IBM) |
|
const String System::CIMSERVER = "qycmcimom"; // Server system ID |
|
#else |
|
const String System::CIMSERVER = "cimserver"; // Server system ID |
|
#endif |
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |