version 1.63, 2006/08/15 19:46:36
|
version 1.68.4.3, 2007/10/16 18:57:18
|
|
|
#endif | #endif |
#endif | #endif |
| |
#ifdef PEGASUS_OS_TYPE_UNIX |
#if defined (PEGASUS_OS_TYPE_UNIX) || \ |
|
defined (PEGASUS_OS_VMS) |
# ifndef PEGASUS_OS_OS400 | # ifndef PEGASUS_OS_OS400 |
# include <unistd.h> | # include <unistd.h> |
# endif | # endif |
|
|
static String getHostName(); | static String getHostName(); |
static String getFullyQualifiedHostName (); | static String getFullyQualifiedHostName (); |
static String getSystemCreationClassName (); | static String getSystemCreationClassName (); |
static String getHostIP(const String &hostName); |
|
| |
static Uint32 _acquireIP(const char* hostname); |
// Gets IP address assosiated with hostName. af indicates the |
|
// type of address (ipv4 or ipv6) returned. |
|
static Boolean getHostIP(const String &hostName, int *af, String &hostIP); |
|
|
|
// Gets IP address in binary form. af indicates the type of |
|
// address (ipv4 or ipv6) returned. Address will be copied to dst. |
|
static Boolean _acquireIP(const char* hostname, int *af, void *dst); |
| |
static Uint32 lookupPort( | static Uint32 lookupPort( |
const char * serviceName, | const char * serviceName, |
Uint32 defaultPort); | Uint32 defaultPort); |
| |
/** | /** |
Attempts to validate that the input hostName represents the same host as |
Attempts to find the given IP address(32bit) on any of the local defined |
the host represented by the value returned by the |
network interfaces |
getFullyQualifiedHostName() method. |
*/ |
|
static Boolean isIpOnNetworkInterface(Uint32 inIP); |
|
|
|
/** |
|
Attempts to resolve a given hostname |
|
this function possibly can take some as it can request information |
|
from the DNS |
|
|
|
@param resolvedNameIP On successful hostname resolution, this output |
|
parameter contains the IP address that was determined. |
|
@return true if successful, false if not successful. |
|
*/ |
|
static Boolean resolveHostNameAtDNS( |
|
const char* hostname, |
|
Uint32* resolvedNameIP); |
|
|
|
/** |
|
Attempts to resolve a given IP address |
|
this function possibly can take some as it can request information |
|
from the DNS |
|
@param resolvedIP On successful hostname resolution, this output |
|
parameter contains the IP address that was determined. |
|
@return true if successful, false if not successful. |
|
*/ |
|
static Boolean resolveIPAtDNS(Uint32 ip_addr, Uint32 * resolvedIP); |
| |
@param hostName the host name to validate |
/** |
|
Bundling function used to determine if a given hostname or IP address |
|
belongs to the local host |
|
this function has the potential to take some time as it will possibly |
|
use the DNS |
|
*/ |
|
static Boolean isLocalHost(const String& hostName); |
| |
@return True if the input hostName can be validated to represent the |
/** |
same host; |
Checks binIPAddress represented by address family and returns true |
False otherwise |
if binary representation matches with loopback ip address. binIPAddress |
|
must be in host-byte order. |
*/ | */ |
static Boolean sameHost (const String & hostName); |
static Boolean isLoopBack(int af, void *binIPAddress); |
| |
static String getEffectiveUserName(); | static String getEffectiveUserName(); |
| |
|
|
| |
/** | /** |
This function is used to encrypt the user's password. | This function is used to encrypt the user's password. |
The encryption is compatible with Apache's password file (generated using |
The encryption is compatible with Apache's password file (generated |
the htpasswd command ) |
using the htpasswd command) |
| |
@param password Password to be encrypted. | @param password Password to be encrypted. |
@param salt Two character string chosen from the set [a-zA-Z0-9./]. | @param salt Two character string chosen from the set [a-zA-Z0-9./]. |
|
|
| |
/** | /** |
This function returns the privileged user name on the system. | This function returns the privileged user name on the system. |
|
|
@return the privileged user name | @return the privileged user name |
*/ | */ |
static String getPrivilegedUserName(); | static String getPrivilegedUserName(); |
|
|
of the specified user group. | of the specified user group. |
| |
@param userName User name to be verified. | @param userName User name to be verified. |
|
|
@param groupName User group name. | @param groupName User group name. |
| |
@return true if the user is a member of the user group, |
@return true if the user is a member of the user group, false otherwise. |
false otherwise. |
@throw InternalSystemError - If there is an error accessing the |
|
specified user or group information. |
@throw InternalSystemError - If there is an error |
|
accessing the specified user or group information. |
|
*/ | */ |
static Boolean isGroupMember(const char* userName, const char* groupName); | static Boolean isGroupMember(const char* userName, const char* groupName); |
| |
|
|
#endif | #endif |
| |
/** | /** |
Changes the process user context to the specified user and group ID. |
Changes the process user context to the specified user and group. |
|
IMPORTANT: This method uses non-reentrant functions and should only |
|
be called in a single-threaded program. |
|
@param userName User name to set as the process user context. |
@param uid User ID to set as the process user context. | @param uid User ID to set as the process user context. |
@param gid Group ID to set as the process group context. | @param gid Group ID to set as the process group context. |
@return True if the user context is successfully changed, | @return True if the user context is successfully changed, |
false otherwise. | false otherwise. |
*/ | */ |
#ifndef PEGASUS_OS_OS400 | #ifndef PEGASUS_OS_OS400 |
static Boolean changeUserContext( |
static Boolean changeUserContext_SingleThreaded( |
|
const char* userName, |
const PEGASUS_UID_T& uid, | const PEGASUS_UID_T& uid, |
const PEGASUS_GID_T& gid); | const PEGASUS_GID_T& gid); |
#endif | #endif |
| |
/** | /** |
This function is used to get the process ID of the calling process. | This function is used to get the process ID of the calling process. |
|
|
@return Process ID | @return Process ID |
*/ | */ |
static Uint32 getPID(); | static Uint32 getPID(); |
|
|
Uint32 severity, | Uint32 severity, |
const char* message); | const char* message); |
| |
|
static void openlog( |
|
const char *ident, |
|
int logopt, |
|
int facility); |
|
|
|
static void closelog(); |
|
|
// System ID constants for Logger::put and Logger::trace | // System ID constants for Logger::put and Logger::trace |
static const String CIMSERVER; | static const String CIMSERVER; |
| |
|
|
The AutoFileLock class uses an advisory file lock to allow access to a | The AutoFileLock class uses an advisory file lock to allow access to a |
resource to be controlled. | resource to be controlled. |
*/ | */ |
class AutoFileLock |
class PEGASUS_COMMON_LINKAGE AutoFileLock |
{ | { |
public: | public: |
| |