本文整理汇总了C++中PEG_METHOD_EXIT函数的典型用法代码示例。如果您正苦于以下问题:C++ PEG_METHOD_EXIT函数的具体用法?C++ PEG_METHOD_EXIT怎么用?C++ PEG_METHOD_EXIT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了PEG_METHOD_EXIT函数的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: PEG_METHOD_ENTER
//
// Modify instance based on modifiedInstance.
//
void UserAuthProvider::modifyInstance(
const OperationContext & context,
const CIMObjectPath & instanceReference,
const CIMInstance& modifiedIns,
const Boolean includeQualifiers,
const CIMPropertyList & propertyList,
ResponseHandler & handler)
{
PEG_METHOD_ENTER(TRC_USER_MANAGER,"UserAuthProvider::modifyInstance");
//
// get userName
//
String user;
try
{
IdentityContainer container = context.get(IdentityContainer::NAME);
user= container.getUserName();
}
catch (...)
{
user= String::EMPTY;
}
//
// verify user authorizations
//
if ( user != String::EMPTY || user != "" )
{
_verifyAuthorization(user);
}
//
// check if the class name requested is PG_Authorization
//
if (!instanceReference.getClassName().equal (CLASS_NAME_PG_AUTHORIZATION))
{
PEG_METHOD_EXIT();
throw PEGASUS_CIM_EXCEPTION (
CIM_ERR_NOT_SUPPORTED, instanceReference.getClassName().getString());
}
CIMInstance newInstance = modifiedIns;
// begin processing the request
handler.processing();
try
{
//
// Get the user name from the instance
//
String userNameStr;
String namespaceStr;
String authorizationStr;
Uint32 pos = modifiedIns.findProperty ( PROPERTY_NAME_USERNAME );
CIMProperty prop = (CIMProperty)newInstance.getProperty(pos);
prop.getValue().get(userNameStr);
//
// Get the namespace from the instance
//
pos = modifiedIns.findProperty ( PROPERTY_NAME_NAMESPACE );
prop = (CIMProperty)newInstance.getProperty(pos);
prop.getValue().get(namespaceStr);
//
// Get the authorization from the instance
//
pos = modifiedIns.findProperty ( PROPERTY_NAME_AUTHORIZATION );
prop = (CIMProperty)newInstance.getProperty(pos);
prop.getValue().get(authorizationStr);
//
// ATTN: Note that the following is a hack, because
// modifyInstance() in repository does not like
// the hostname and namespace included in the CIMObjectPath
// passed to it as a parameter.
//
CIMObjectPath ref("", CIMNamespaceName (),
modifiedIns.getClassName(), instanceReference.getKeyBindings());
CIMInstance newModifiedIns = modifiedIns.clone ();
newModifiedIns.setPath (ref);
//
// call modifyInstances of the repository
//
_repository->modifyInstance(
instanceReference.getNameSpace(), newModifiedIns);
//
// set authorization in the UserManager
//
_userManager->setAuthorization(
userNameStr, namespaceStr, authorizationStr );
//.........这里部分代码省略.........
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:101,代码来源:UserAuthProvider.cpp
示例2: PEG_METHOD_ENTER
PEGASUS_NAMESPACE_BEGIN
/*****************************************************************************
*
* Implementation of AssociationProvider associators method
*
*****************************************************************************/
void InteropProvider::associators(
const OperationContext & context,
const CIMObjectPath & objectName,
const CIMName & associationClass,
const CIMName & resultClass,
const String & role,
const String & resultRole,
const Boolean includeQualifiers,
const Boolean includeClassOrigin,
const CIMPropertyList & propertyList,
ObjectResponseHandler & handler)
{
PEG_METHOD_ENTER(TRC_CONTROLPROVIDER,
"InteropProvider::associators()");
initProvider();
PEG_TRACE((TRC_CONTROLPROVIDER, Tracer::LEVEL4,
"%s associators. objectName= %s, assocClass= %s resultClass= %s "
"role= %s resultRole %s, includeQualifiers= %s, "
"includeClassOrigin= %s, PropertyList= %s",
thisProvider,
(const char *)objectName.toString().getCString(),
(const char *)associationClass.getString().getCString(),
(const char *)resultClass.getString().getCString(),
(const char *)role.getCString(),
(const char *)resultRole.getCString(),
boolToString(includeQualifiers),
boolToString(includeClassOrigin),
(const char *)propertyListToString(propertyList).getCString()));
handler.processing();
String originRole = role;
String targetRole = resultRole;
Uint32 numIterations = 1;
//
// The localReferences call retrieves instances of the desired association
// class and sets the originRole and targetRole properties if currently
// empty.
//
if (associationClass.equal(PEGASUS_CLASSNAME_PG_REFERENCEDPROFILE))
{
if (originRole.size() == 0 && targetRole.size() == 0)
{
originRole = String("Antecedent");
targetRole = String("Dependent");
numIterations = 2;
}
}
for (Uint32 i = 0; i < numIterations; ++i)
{
Array<CIMInstance> refs = localReferences(
context,
objectName,
associationClass,
originRole,
targetRole,
CIMPropertyList(),
resultClass);
if( refs.size() )
{
Array<CIMInstance> refObjs =
getReferencedInstances(refs,targetRole,context,propertyList);
ConstArrayIterator<CIMInstance> refsIterator(refObjs);
for(Uint32 i = 0; i < refsIterator.size(); i++)
{
handler.deliver(refsIterator[i]);
}
}
if (numIterations == 2)
{
originRole = String("Dependent");
targetRole = String("Antecedent");
}
}
handler.complete();
PEG_METHOD_EXIT();
}
开发者ID:rdobson,项目名称:openpegasus,代码行数:86,代码来源:InteropAssociationProvider.cpp
示例3: PEG_METHOD_ENTER
//
// create a file and make a random token data entry to it.
// send the file name back to caller
//
String LocalAuthFile::create()
{
PEG_METHOD_ENTER(TRC_AUTHENTICATION, "LocalAuthFile::create()");
Uint32 secs, milliSecs;
Uint32 mySequenceNumber;
System::getCurrentTime(secs, milliSecs);
//
// extension size is username plus the sequence count
//
{
AutoMutex autoMut(sequenceCountLock);
mySequenceNumber = sequenceCount++;
} // mutex unlocks here
char extension[2*INT_BUFFER_SIZE];
sprintf(extension,"_%u_%u", mySequenceNumber, milliSecs);
extension[strlen(extension)] = 0;
String filePath;
// Check to see whether a domain was specified. If so, strip the domain
// from the local auth file name, since the backslash and '@' are invalid
// filename characters. Store this in another variable, since we need to
// keep the domain around for the rest of the operations.
String fileUserName = _userName;
Uint32 index = _userName.find('\\');
if (index != PEG_NOT_FOUND)
{
fileUserName = _userName.subString(index + 1);
}
else
{
index = _userName.find('@');
if (index != PEG_NOT_FOUND)
{
fileUserName = _userName.subString(0, index);
}
}
filePath.append(_authFilePath);
filePath.append(fileUserName);//_userName);
filePath.append(extension);
CString filePathCString = filePath.getCString();
//
// 1. Create a file name for authentication.
//
ofstream outfs(filePathCString);
if (!outfs)
{
// unable to create file
Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
MessageLoaderParms(
"Security.Authentication.LocalAuthFile.NO_CREATE",
"Creation of the local authentication security file"
" $0 failed: $1",
filePath, strerror(errno)));
PEG_METHOD_EXIT();
throw CannotOpenFile (filePath);
}
outfs.clear();
//
// 2. Set file permission to read/write by the owner only.
//
#if defined(PEGASUS_OS_TYPE_WINDOWS)
Boolean success =
FileSystem::changeFilePermissions(filePath, _S_IREAD | _S_IWRITE);
#else
Boolean success =
FileSystem::changeFilePermissions(filePath, S_IRUSR | S_IWUSR);
#endif
if (!success)
{
// Unable to change the local auth file permissions, remove the file
// and throw CannotOpenFile error.
Logger::put_l(Logger::ERROR_LOG, System::CIMSERVER, Logger::SEVERE,
MessageLoaderParms(
"Security.Authentication.LocalAuthFile.NO_CHMOD",
"Changing permissions of the local authentication security "
"file $0 failed: $1",
filePath, strerror(errno)));
if (filePath.size())
{
if (FileSystem::exists(filePath))
{
FileSystem::removeFile(filePath);
}
}
//.........这里部分代码省略.........
开发者ID:brunolauze,项目名称:pegasus,代码行数:101,代码来源:LocalAuthFile.cpp
示例4: PEG_METHOD_ENTER
Sint16 DefaultProviderManager::_disableProvider(
const String& moduleName,
const String& providerName)
{
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER,
"DefaultProviderManager::_disableProvider");
ProviderMessageHandler* pr = _lookupProvider(moduleName, providerName);
if (!pr->status.isInitialized())
{
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL2,
"Provider %s is not loaded",
(const char*)providerName.getCString()));
PEG_METHOD_EXIT();
return 1;
}
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,"Disable Provider %s",
(const char*)pr->getName().getCString()));
//
// Check to see if there are pending requests. If there are pending
// requests and the disable timeout has not expired, loop and wait one
// second until either there is no pending requests or until timeout
// expires.
//
Uint32 waitTime = PROVIDER_DISABLE_TIMEOUT;
while ((pr->status.numCurrentOperations() > 0) && (waitTime > 0))
{
Threads::sleep(1000);
waitTime = waitTime - 1;
}
// There are still pending requests, do not disable
if (pr->status.numCurrentOperations() > 0)
{
PEG_TRACE_CSTRING(TRC_PROVIDERMANAGER, Tracer::LEVEL4,
"Disable failed since there are pending requests.");
PEG_METHOD_EXIT();
return 0;
}
try
{
AutoMutex lock(pr->status.getStatusMutex());
if (pr->status.isInitialized())
{
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL4,
"Unloading Provider %s",
(const char*)pr->getName().getCString()));
_unloadProvider(pr);
}
}
catch (...)
{
PEG_TRACE((TRC_PROVIDERMANAGER, Tracer::LEVEL2,
"Unload provider failed %s",
(const char*)pr->getName().getCString()));
PEG_METHOD_EXIT();
return -1;
}
PEG_METHOD_EXIT();
return 1;
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:65,代码来源:DefaultProviderManager.cpp
示例5: PEG_METHOD_ENTER
//.........这里部分代码省略.........
#ifdef PEGASUS_OS_ZOS
// Establish handling signal send to us on USS shutdown
getSigHandle()->registerHandler(PEGASUS_SIGDANGER, _terminateSignalHandler);
getSigHandle()->activate(PEGASUS_SIGDANGER);
// enable process to receive SIGDANGER on USS shutdown
__shutdown_registration(_SDR_NOTIFY, _SDR_REGPROCESS, _SDR_SENDSIGDANGER);
#endif
#ifdef PEGASUS_OS_PASE
// PASE environment need more signal handler
getSigHandle()->registerHandler(SIGFPE, _synchronousSignalHandler);
getSigHandle()->activate(SIGFPE);
getSigHandle()->registerHandler(SIGILL, _synchronousSignalHandler);
getSigHandle()->activate(SIGILL);
getSigHandle()->registerHandler(SIGSEGV, _synchronousSignalHandler);
getSigHandle()->activate(SIGSEGV);
getSigHandle()->registerHandler(SIGIO, _asynchronousSignalHandler);
getSigHandle()->activate(SIGIO);
#endif
while (!_terminating)
{
Boolean active = true;
try
{
//
// Read and process the next request
//
active = _readAndProcessRequest();
}
catch (Exception& e)
{
PEG_TRACE((TRC_PROVIDERAGENT, Tracer::LEVEL1,
"Unexpected Exception from _readAndProcessRequest(): %s",
(const char*)e.getMessage().getCString()));
_terminating = true;
}
catch (...)
{
PEG_TRACE_CSTRING(TRC_PROVIDERAGENT, Tracer::LEVEL1,
"Unexpected exception from _readAndProcessRequest().");
_terminating = true;
}
if (_terminating)
{
if (!_providersStopped)
{
//
// Stop all providers
//
CIMStopAllProvidersRequestMessage
stopRequest("0", QueueIdStack(0));
AutoPtr<Message> stopResponse(_processRequest(&stopRequest));
// If there are agent threads running exit from here.If provider
// is not responding cimprovagt may loop forever in ThreadPool
// destructor waiting for running threads to become idle.
if (_threadPool.runningCount())
{
PEG_TRACE_CSTRING(TRC_PROVIDERAGENT,
Tracer::LEVEL1,
"Agent threads are running, terminating forcibly.");
exit(1);
}
}
}
else if (!active)
{
//
// Stop agent process when no more providers are loaded
//
try
{
if (!_providerManagerRouter.hasActiveProviders() &&
(_threadPool.runningCount() == 0))
{
PEG_TRACE_CSTRING(TRC_PROVIDERAGENT, Tracer::LEVEL2,
"No active providers. Exiting.");
_terminating = true;
}
else
{
_threadPool.cleanupIdleThreads();
}
}
catch (...)
{
// Do not terminate the agent on this exception
PEG_TRACE_CSTRING(TRC_PROVIDERAGENT, Tracer::LEVEL1,
"Unexpected exception from hasActiveProviders()");
}
}
}
// Notify the cimserver that the provider agent is exiting cleanly.
Uint32 messageLength = 0;
_pipeToServer->writeBuffer((const char*)&messageLength, sizeof(Uint32));
PEG_METHOD_EXIT();
}
开发者ID:rdobson,项目名称:openpegasus,代码行数:101,代码来源:ProviderAgent.cpp
示例6: PEG_METHOD_ENTER
//
// Destructor
//
UserManager::~UserManager()
{
PEG_METHOD_ENTER(TRC_USER_MANAGER, "UserManager::~UserManager");
PEG_METHOD_EXIT();
}
开发者ID:brunolauze,项目名称:pegasus,代码行数:9,代码来源:UserManager.cpp
示例7: PEG_METHOD_ENTER
HTTPConnection* HTTPConnector::connect(
const String& host,
const Uint32 portNumber,
SSLContext * sslContext,
Uint32 timeoutMilliseconds,
MessageQueue* outputMessageQueue)
{
PEG_METHOD_ENTER(TRC_HTTP, "HTTPConnector::connect()");
#ifdef PEGASUS_OS_PASE
AutoPtr<PaseCcsid> ccsid;
#endif
SocketHandle socket = PEGASUS_INVALID_SOCKET;
// Use an AutoPtr to ensure the socket handle is closed on exception
AutoPtr<SocketHandle, CloseSocketHandle> socketPtr(&socket);
#ifndef PEGASUS_DISABLE_LOCAL_DOMAIN_SOCKET
if (0 == host.size())
{
// Set up the domain socket for a local connection
sockaddr_un address;
#ifdef PEGASUS_OS_PASE
// PASE needs ccsid 819 to perform domain socket operation
int orig_ccsid;
orig_ccsid = _SETCCSID(-1);
if (orig_ccsid == -1)
{
PEG_TRACE_CSTRING(TRC_DISCARDED_DATA, Tracer::LEVEL2,
"HTTPConnector::connect() Can not get current PASE CCSID.");
orig_ccsid = 1208;
}
ccsid.reset(new PaseCcsid(819, orig_ccsid));
#endif
memset(&address, 0, sizeof(address));
address.sun_family = AF_UNIX;
strcpy(address.sun_path, PEGASUS_LOCAL_DOMAIN_SOCKET_PATH);
socket = Socket::createSocket(AF_UNIX, SOCK_STREAM, 0);
if (socket == PEGASUS_INVALID_SOCKET)
{
PEG_METHOD_EXIT();
throw CannotCreateSocketException();
}
Socket::disableBlocking(socket);
// Connect the socket to the address:
if (!Socket::timedConnect(
socket,
reinterpret_cast<sockaddr*>(&address),
sizeof(address),
timeoutMilliseconds))
{
MessageLoaderParms parms(
"Common.HTTPConnector.CONNECTION_FAILED_LOCAL_CIM_SERVER",
"Cannot connect to local CIM server. Connection failed.");
PEG_METHOD_EXIT();
throw CannotConnectException(parms);
}
}
else
#endif
{
// Set up the IP socket connection
// Make the internet address:
#ifdef PEGASUS_ENABLE_IPV6
struct addrinfo *addrInfo, *addrInfoRoot = NULL;
#else
sockaddr_in address;
#endif
#ifdef PEGASUS_ENABLE_IPV6
if (!_MakeAddress(
(const char*)host.getCString(),
portNumber,
(void**)(void*)&addrInfoRoot))
#else
if (!_MakeAddress((const char*)host.getCString(), portNumber, address))
#endif
{
char scratch[22];
Uint32 n;
const char * portStr = Uint32ToString(scratch, portNumber, n);
PEG_METHOD_EXIT();
throw InvalidLocatorException(host+":"+String(portStr,n));
}
#ifdef PEGASUS_ENABLE_IPV6
addrInfo = addrInfoRoot;
while (addrInfo)
{
// Create the socket:
socket = Socket::createSocket(addrInfo->ai_family,
addrInfo->ai_socktype, addrInfo->ai_protocol);
#else
//.........这里部分代码省略.........
开发者ID:govindraopanduru,项目名称:neopegasus,代码行数:101,代码来源:HTTPConnector.cpp
示例8: PEG_METHOD_ENTER
//.........这里部分代码省略.........
switch( op )
{
case WQL_OR:
case WQL_AND:
{
PEGASUS_ASSERT(stack.size() >= 2);
CMPI_stack_el op1 = stack.top();
stack.pop();
CMPI_stack_el op2 = stack.top();
// generate Eval expression
eval_heap.append(CMPI_eval_el(
0, op , op1.opn,
op1.is_terminal,op2.opn ,
op2.is_terminal));
stack.top() = CMPI_stack_el(eval_heap.size()-1, false);
break;
}
case WQL_NOT:
case WQL_IS_FALSE:
case WQL_IS_NOT_TRUE:
{
PEGASUS_ASSERT(stack.size() >= 1);
CMPI_stack_el op1 = stack.top();
// generate Eval expression
eval_heap.append(CMPI_eval_el(
0, op , op1.opn,
op1.is_terminal,-1, true));
stack.top() = CMPI_stack_el(eval_heap.size()-1, false);
break;
}
case WQL_EQ:
case WQL_NE:
case WQL_LT:
case WQL_LE:
case WQL_GT:
case WQL_GE:
{
PEGASUS_ASSERT(wqsrep->_operands.size() >= 2);
WQLOperand lhs = wqsrep->_operands[j++];
WQLOperand rhs = wqsrep->_operands[j++];
terminal_heap.push(term_el_WQL(false, op, lhs, rhs));
stack.push(CMPI_stack_el(terminal_heap.size()-1, true));
break;
}
case WQL_IS_TRUE:
case WQL_IS_NOT_FALSE:
{
PEGASUS_ASSERT(stack.size() >= 1);
break;
}
case WQL_IS_NULL:
{
PEGASUS_ASSERT(wqsrep->_operands.size() >= 1);
WQLOperand operand = wqsrep->_operands[j++];
terminal_heap.push(
term_el_WQL(false, WQL_EQ, operand, dummy));
stack.push(CMPI_stack_el(terminal_heap.size()-1, true));
break;
}
case WQL_IS_NOT_NULL:
{
PEGASUS_ASSERT(wqsrep->_operands.size() >= 1);
WQLOperand operand = wqsrep->_operands[j++];
terminal_heap.push(
term_el_WQL(false, WQL_NE, operand, dummy));
stack.push(CMPI_stack_el(terminal_heap.size()-1, true));
break;
}
}
}
PEGASUS_ASSERT(stack.size() == 1);
PEG_METHOD_EXIT();
}
开发者ID:host1812,项目名称:scx_plugin_public,代码行数:101,代码来源:CMPI_Wql2Dnf.cpp
示例9: PEG_METHOD_ENTER
void JMPILocalProviderManager::shutdownAllProviders(void)
{
PEG_METHOD_ENTER(TRC_PROVIDERMANAGER, "ProviderManager::shutdownAllProviders");
_provider_ctrl(UNLOAD_ALL_PROVIDERS, (void *)this, (void *)0);
PEG_METHOD_EXIT();
}
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:6,代码来源:JMPILocalProviderManager.cpp
示例10: PEG_METHOD_ENTER
void CIMQualifierList::resolve(
DeclContext* declContext,
const CIMNamespaceName & nameSpace,
CIMScope scope, // Scope of the entity being resolved.
Boolean isInstancePart,
CIMQualifierList& inheritedQualifiers,
Boolean propagateQualifiers)
{
_keyIndex = PEGASUS_ORDEREDSET_INDEX_UNKNOWN;
PEG_METHOD_ENTER(TRC_OBJECTRESOLUTION, "CIMQualifierList::resolve()");
// For each qualifier in the qualifiers array, the following
// is checked:
//
// 1. Whether it is declared (can be obtained from the declContext).
//
// 2. Whether it has the same type as the declaration.
//
// 3. Whether the qualifier is valid for the given scope.
//
// 4. Whether the qualifier can be overriden (the flavor is
// ENABLEOVERRIDE on the corresponding reference qualifier).
//
// 5. Whether the qualifier should be propagated to the subclass.
//
// If the qualifier should be overriden, then it is injected into the
// qualifiers array (from the inheritedQualifiers array).
for (Uint32 i = 0, n = _qualifiers.size(); i < n; i++)
{
CIMQualifier q = _qualifiers[i];
//----------------------------------------------------------------------
// 1. Check to see if it's declared.
//----------------------------------------------------------------------
// set this back to CIMConstQualifierDecl
CIMQualifierDecl qd = declContext->lookupQualifierDecl(
nameSpace, q.getName());
if (qd.isUninitialized())
{
PEG_METHOD_EXIT();
throw UndeclaredQualifier(q.getName().getString ());
}
//----------------------------------------------------------------------
// 2. Check the type and isArray. Must be the same:
//----------------------------------------------------------------------
if (!(q.getType() == qd.getType() && q.isArray() == qd.isArray()))
{
PEG_METHOD_EXIT();
throw BadQualifierType(q.getName().getString ());
}
//----------------------------------------------------------------------
// 3. If the qualifier is the EmbeddedInstance qualifier, then check
// that the class specified by the qualifier exists in the namespace.
//----------------------------------------------------------------------
if (q.getName().equal(PEGASUS_QUALIFIERNAME_EMBEDDEDINSTANCE))
{
String className;
q.getValue().get(className);
CIMClass classDef = declContext->lookupClass(nameSpace,
CIMName(className));
if (classDef.isUninitialized())
{
String embeddedInstType("EmbeddedInstance(\"");
embeddedInstType = embeddedInstType + className + "\")";
PEG_METHOD_EXIT();
throw BadQualifierType(embeddedInstType);
}
}
//----------------------------------------------------------------------
// 4. Check the scope: Must be legal for this qualifier
//----------------------------------------------------------------------
// ATTN: These lines throw a bogus exception if the qualifier has
// a valid scope (such as Scope::ASSOCIATION) which is not Scope::CLASS
// ks Mar 2002. Reinstalled 23 March 2002 to test.
if (!(qd.getScope().hasScope (scope)))
{
PEG_METHOD_EXIT();
throw BadQualifierScope
(qd.getName().getString (), scope.toString ());
}
//----------------------------------------------------------------------
// Resolve the qualifierflavor. Since Flavors are a combination of
// inheritance and input characteristics, resolve the inherited
// characteristics against those provided with the creation. If
// there is a superclass the flavor is resolved against that
// superclass. If not, it is resolved against the declaration. If
// the flavor is disableoverride and tosubclass the resolved
// qualifier value must be identical to the original
//----------------------------------------------------------------------
// Test for Qualifier found in SuperClass. If found and qualifier
// is not overridable.
// Abstract (not Overridable and restricted) can be found in subclasses
// Can have nonabstracts below abstracts. That is function of
//.........这里部分代码省略.........
开发者ID:kaixuanlive,项目名称:openpegasus,代码行数:101,代码来源:CIMQualifierList.cpp
示例11: PEG_METHOD_ENTER
Boolean BasicAuthenticationHandler::authenticate(
const String& authHeader,
AuthenticationInfo* authInfo)
{
PEG_METHOD_ENTER(
TRC_AUTHENTICATION, "BasicAuthenticationHandler::authenticate()");
Boolean authenticated = false;
//
// copy userPass string to char array for decoding
//
Array<char> userPassArray;
Uint32 length = authHeader.size();
userPassArray.reserveCapacity( length );
userPassArray.clear();
for( Uint32 i = 0; i < length; i++ )
{
userPassArray.append( static_cast<char>(authHeader[i]) );
}
//
// base64 decode the userPass array
//
Array<char> decodedArray;
decodedArray = Base64::decode( userPassArray );
String decodedStr =
String( (const char*)decodedArray.getData(), decodedArray.size() );
Uint32 pos = decodedStr.find(':');
if (pos == PEG_NOT_FOUND)
{
PEG_METHOD_EXIT();
return (authenticated);
}
String userName = decodedStr.subString(0, pos);
String password = decodedStr.subString(pos + 1);
#ifdef PEGASUS_OS_OS400
// OS400 APIs require user profile to be uppercase
for(int i=0; i < userName.size(); i++)
{
userName[i] = toupper(userName[i]);
}
#endif
#ifdef PEGASUS_WMIMAPPER
authenticated = true;
authInfo->setAuthenticatedUser(userName);
authInfo->setAuthenticatedPassword(password);
#else
authenticated = _basicAuthenticator->authenticate(userName, password);
if (authenticated)
{
authInfo->setAuthenticatedUser(userName);
}
#endif
PEG_METHOD_EXIT();
return (authenticated);
}
开发者ID:ncultra,项目名称:Pegasus-2.5,代码行数:72,代码来源:BasicAuthenticationHandler.cpp
注:本文中的PEG_METHOD_EXIT函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论