MCPcopy Create free account
hub / github.com/FirebirdSQL/firebird / authenticate

Method authenticate

src/auth/trusted/AuthSspi.cpp:384–474  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

382{ }
383
384int WinSspiServer::authenticate(Firebird::CheckStatusWrapper* status,
385 IServerBlock* sBlock,
386 IWriter* writerInterface)
387{
388 try
389 {
390 sspiData.clear();
391 unsigned int length;
392 const unsigned char* bytes = sBlock->getData(&length);
393 sspiData.add(bytes, length);
394
395 if (done && !length && !sspi.isActive())
396 return AUTH_SUCCESS;
397
398 if (!sspi.accept(sspiData))
399 return AUTH_CONTINUE;
400
401 if (!sspi.isActive())
402 {
403 bool wheel = false;
404 string login;
405 AuthSspi::GroupsList grNames;
406 sspi.getLogin(login, wheel, grNames);
407 ISC_systemToUtf8(login);
408
409 // publish user name obtained during SSPI handshake
410 writerInterface->add(status, login.c_str());
411 if (status->getState() & IStatus::STATE_ERRORS)
412 return AUTH_FAILED;
413
414 // is it suser account?
415 if (wheel)
416 {
417 writerInterface->add(status, FB_DOMAIN_ANY_RID_ADMINS);
418 if (status->getState() & IStatus::STATE_ERRORS)
419 return AUTH_FAILED;
420
421 writerInterface->setType(status, FB_PREDEFINED_GROUP);
422
423 if (status->getState() & IStatus::STATE_ERRORS)
424 return AUTH_FAILED;
425 }
426
427 // walk groups to which login belongs and list them using writerInterface
428 Firebird::string grName;
429
430 for (unsigned n = 0; n < grNames.getCount(); ++n)
431 {
432 grName = grNames[n];
433 ISC_systemToUtf8(grName);
434 writerInterface->add(status, grName.c_str());
435
436 if (status->getState() & IStatus::STATE_ERRORS)
437 return AUTH_FAILED;
438
439 writerInterface->setType(status, "Group");
440
441 if (status->getState() & IStatus::STATE_ERRORS)

Callers

nothing calls this directly

Calls 15

ISC_systemToUtf8Function · 0.85
clearMethod · 0.45
getDataMethod · 0.45
addMethod · 0.45
isActiveMethod · 0.45
acceptMethod · 0.45
getLoginMethod · 0.45
c_strMethod · 0.45
getStateMethod · 0.45
setTypeMethod · 0.45
getCountMethod · 0.45
getKeyMethod · 0.45

Tested by

no test coverage detected